We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An error happened when publishing the component: {}
--- ./oc-patch/oc-registry-routes/publish_original.js 2023-03-01 11:37:29.000000000 +0000 +++ ./oc-patch/oc-registry-routes/publish_modified.js 2023-03-01 11:40:50.000000000 +0000 @@ -70,25 +70,35 @@ res.status(200).json({ ok: true }); } catch (err) { + console.error('Patched OC->Registry->Routes->Publish: ', JSON.stringify(err)); + let errorMessage; + if(err.msg) { + errorMessage = err.msg; + } else if (err.message){ + errorMessage = err.message; + } else { + errorMessage = JSON.stringify(err); + } + if (err.code === 'not_allowed') { - res.errorDetails = `Publish not allowed: ${err.msg}`; - res.status(403).json({ error: err.msg }); + res.errorDetails = `Publish not allowed: ${errorMessage}`; + res.status(403).json({ error: err }); } else if (err.code === 'already_exists') { - res.errorDetails = `Component already exists: ${err.msg}`; - res.status(403).json({ error: err.msg }); + res.errorDetails = `Component already exists: ${errorMessage}`; + res.status(403).json({ error: err }); } else if (err.code === 'name_not_valid') { - res.errorDetails = `Component name not valid: ${err.msg}`; - res.status(409).json({ error: err.msg }); + res.errorDetails = `Component name not valid: ${errorMessage}`; + res.status(409).json({ error: err }); } else if (err.code === 'version_not_valid') { - res.errorDetails = `Component version not valid: ${err.msg}`; - res.status(409).json({ error: err.msg }); + res.errorDetails = `Component version not valid: ${errorMessage}`; + res.status(409).json({ error: err }); } else { - res.errorDetails = `Publish failed: ${err.msg}`; - res.status(500).json({ error: err.msg }); + res.errorDetails = `Publish failed: ${errorMessage}`; + res.status(500).json({ error: err }); } } }
The text was updated successfully, but these errors were encountered:
The whole treating of errors should be normalized honestly across the codebase, but I'm fine with this adhoc solution for the moment
Sorry, something went wrong.
Thanks @ricardo-devis-agullo , Raised PR for review
No branches or pull requests
Who is the bug affecting?
What is affected by this bug?
When does this occur?
Where on the platform does it happen?
How do we replicate the issue?
Expected behavior (i.e. solution)
What version of OC, Node.js and OS are you using?
Other Comments
The text was updated successfully, but these errors were encountered: