Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
b410e1c8
Commit
b410e1c8
authored
5 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
added some comments for handling file creation errors
parent
aac6beeb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/v1/api_files.go
+16
-2
16 additions, 2 deletions
api/v1/api_files.go
with
16 additions
and
2 deletions
api/v1/api_files.go
+
16
−
2
View file @
b410e1c8
...
...
@@ -95,16 +95,27 @@ func (api *API) CreateFileForShow() http.Handler {
sendError
(
w
,
err
)
return
}
// TODO: from here on, in case of an error we should either delete the newly created
// file or at least return the id of the created file so the UI can deal with it.
refID
:=
""
// TODO: get this from query paremeter
job
,
err
:=
api
.
importer
.
CreateJob
(
showID
,
file
.
ID
,
*
srcURI
,
sess
.
Username
,
refID
)
if
err
!=
nil
{
// shall we remove the file here... thinking...
// possible errors:
// - importer.ErrSourceNotSupported -> delete file
// - any error returned by store.GetFile():
// possible reasons for this:
// * connection problem to the store database
// * somebody deleted the file
// - importer.ErrFileNotNew -> leave file
sendError
(
w
,
err
)
return
}
if
err
=
job
.
Start
(
context
.
Background
(),
3
*
time
.
Hour
);
err
!=
nil
{
// TODO: hardcoded value
// shall we remove the file here... thinking...
// possible errors:
// - importer.ErrAlreadyCanceled -> ??
// - error while creating job workdir -> ??
// - importer.ErrTooManyJobs -> ??
sendError
(
w
,
err
)
return
}
...
...
@@ -120,6 +131,9 @@ func (api *API) CreateFileForShow() http.Handler {
<-
job
.
Done
()
}
if
file
,
err
=
api
.
store
.
GetFile
(
showID
,
file
.
ID
);
err
!=
nil
{
// possible reasons why this failed:
// - connection problem to the store database
// - somebody deleted the file
sendError
(
w
,
err
)
return
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment