Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
GitHub Mirror
Renovate Bot
renovate
Commits
f3c8fd23
Unverified
Commit
f3c8fd23
authored
7 years ago
by
Rhys Arkins
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: stringify unknown errors for better visibility (#1449)
feat: stringify unknown errors for better visibility
parent
6c57c5f4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/workers/repository/error.js
+19
-1
19 additions, 1 deletion
lib/workers/repository/error.js
with
19 additions
and
1 deletion
lib/workers/repository/error.js
+
19
−
1
View file @
f3c8fd23
...
...
@@ -38,8 +38,26 @@ async function handleError(config, err) {
return
err
.
message
;
}
// Swallow this error so that other repositories can be processed
logger
.
error
({
err
},
`Repository has unknown error`
);
logger
.
error
(
{
err
},
`Repository has unknown error:\n
${
stringifyError
(
err
,
null
,
'
'
)}
`
);
// delete branchList to avoid cleaning up branches
delete
config
.
branchList
;
// eslint-disable-line no-param-reassign
return
'
unknown-error
'
;
}
function
stringifyError
(
err
,
filter
,
space
)
{
let
stringifiedError
=
''
;
try
{
const
plainObject
=
{};
Object
.
getOwnPropertyNames
(
err
).
forEach
(
key
=>
{
plainObject
[
key
]
=
err
[
key
];
});
stringifiedError
=
JSON
.
stringify
(
plainObject
,
filter
,
space
);
}
catch
(
err2
)
{
// istanbul ignore next
logger
.
warn
({
err2
},
'
Error stringifying unknown error
'
);
}
return
stringifiedError
;
}
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