refactor: Improve error logging/reporting for cli (#4691)

* use response error classes instead of `ResponseError` everywhere

* improve error logging in dev mode or when telemetry is disabled
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-11-22 14:00:36 +01:00
committed by GitHub
parent 5364e7fc92
commit 0b754a4f85
29 changed files with 253 additions and 393 deletions

View File

@@ -90,7 +90,7 @@ export function getInstanceBaseUrl(): string {
// TODO: Enforce at model level
export function validatePassword(password?: string): string {
if (!password) {
throw new ResponseHelper.ResponseError('Password is mandatory', undefined, 400);
throw new ResponseHelper.BadRequestError('Password is mandatory');
}
const hasInvalidLength =
@@ -117,7 +117,7 @@ export function validatePassword(password?: string): string {
message.push('Password must contain at least 1 uppercase letter.');
}
throw new ResponseHelper.ResponseError(message.join(' '), undefined, 400);
throw new ResponseHelper.BadRequestError(message.join(' '));
}
return password;