Skip to content
Permalink
Browse files

make id optional in DeploymentNotFound

  • Loading branch information...
juliangruber committed Mar 12, 2019
1 parent 598aa59 commit 564b1a5af392f2ec2335b7d86923829906b1b6eb
@@ -86,7 +86,7 @@ async function performCreateAlias(
return { uid: error.uid, alias: error.alias } as AliasRecord;
}
if (error.code === 'deployment_not_found') {
return new ERRORS.DeploymentNotFound(deployment.uid, contextName);
return new ERRORS.DeploymentNotFound({ context: contextName, id: deployment.uid });
}
if (error.code === 'invalid_alias') {
return new ERRORS.InvalidAlias(alias);
@@ -63,7 +63,7 @@ export default async function createDeploy(

if (error.code === 'not_found') {
// The first argument is the deployment id, which is not available here
return new ERRORS_TS.DeploymentNotFound('', contextName)
return new ERRORS_TS.DeploymentNotFound({ context: contextName })
}

// If the error is unknown, we just throw
@@ -16,7 +16,7 @@ export default async function getDeploymentByIdOrHost(
return deployment;
} catch (error) {
if (error.status === 404) {
return new DeploymentNotFound(idOrHost, contextName);
return new DeploymentNotFound({ id: idOrHost, context: contextName });
}
if (error.status === 403) {
return new DeploymentPermissionDenied(idOrHost, contextName);
@@ -509,7 +509,7 @@ export class DeploymentNotFound extends NowError<
'DEPLOYMENT_NOT_FOUND',
{ id: string; context: string }
> {
constructor(id: string, context: string) {
constructor({ context, id = '' }: { context: string, id: string }) {
super({
code: 'DEPLOYMENT_NOT_FOUND',
meta: { id, context },

0 comments on commit 564b1a5

Please sign in to comment.
You can’t perform that action at this time.