-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
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
change: add a more clear error for duplicate project creation #72
Conversation
bcecc2d
to
9fce6f0
Compare
9fce6f0
to
f61ed37
Compare
Can you also update the JS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
js/src/grpc-client.ts
Outdated
if (error instanceof RpcError && error.code == "ALREADY_EXISTS") { | ||
throw new ProjectAlreadyExistsError(`project id ${project} already exists`); | ||
} else { | ||
throw error; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for an else
block here
if (error instanceof RpcError && error.code == "ALREADY_EXISTS") { | |
throw new ProjectAlreadyExistsError(`project id ${project} already exists`); | |
} else { | |
throw error; | |
} | |
if (error instanceof RpcError && error.code == "ALREADY_EXISTS") { | |
throw new ProjectAlreadyExistsError(`project id ${project} already exists`); | |
} | |
throw error; |
js/src/utils/errors.ts
Outdated
constructor(msg: string) { | ||
super(msg); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need to re-implement the same constructor
constructor(msg: string) { | |
super(msg); | |
} |
Whenever a project is attempted to made again the database throws a uniqueness error. This usually comes not so clearly out clientside and as such this change implements a cleaner error message for handling recreating projects that may occur in instances such as job retries with multiple steps.