summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/SignupApiService.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-22 12:27:54 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-06-06 22:20:17 -0400
commit2cba0ada3cdf6b7ee37fa5c0b54134160be657a9 (patch)
tree38f6b59f7c60eda90677bc178974f71c877afe0d /packages/backend/src/server/api/SignupApiService.ts
parentrender error cause in render-inline-error.ts (diff)
downloadsharkey-2cba0ada3cdf6b7ee37fa5c0b54134160be657a9.tar.gz
sharkey-2cba0ada3cdf6b7ee37fa5c0b54134160be657a9.tar.bz2
sharkey-2cba0ada3cdf6b7ee37fa5c0b54134160be657a9.zip
more use of identifiable errors, improvements to inner error rendering, and more heuristics for is-retryable-error
Diffstat (limited to 'packages/backend/src/server/api/SignupApiService.ts')
-rw-r--r--packages/backend/src/server/api/SignupApiService.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts
index cb71047a24..81e3a5b706 100644
--- a/packages/backend/src/server/api/SignupApiService.ts
+++ b/packages/backend/src/server/api/SignupApiService.ts
@@ -83,37 +83,37 @@ export class SignupApiService {
if (process.env.NODE_ENV !== 'test') {
if (this.meta.enableHcaptcha && this.meta.hcaptchaSecretKey) {
await this.captchaService.verifyHcaptcha(this.meta.hcaptchaSecretKey, body['hcaptcha-response']).catch(err => {
- throw new FastifyReplyError(400, err);
+ throw new FastifyReplyError(400, String(err), err);
});
}
if (this.meta.enableMcaptcha && this.meta.mcaptchaSecretKey && this.meta.mcaptchaSitekey && this.meta.mcaptchaInstanceUrl) {
await this.captchaService.verifyMcaptcha(this.meta.mcaptchaSecretKey, this.meta.mcaptchaSitekey, this.meta.mcaptchaInstanceUrl, body['m-captcha-response']).catch(err => {
- throw new FastifyReplyError(400, err);
+ throw new FastifyReplyError(400, String(err), err);
});
}
if (this.meta.enableRecaptcha && this.meta.recaptchaSecretKey) {
await this.captchaService.verifyRecaptcha(this.meta.recaptchaSecretKey, body['g-recaptcha-response']).catch(err => {
- throw new FastifyReplyError(400, err);
+ throw new FastifyReplyError(400, String(err), err);
});
}
if (this.meta.enableTurnstile && this.meta.turnstileSecretKey) {
await this.captchaService.verifyTurnstile(this.meta.turnstileSecretKey, body['turnstile-response']).catch(err => {
- throw new FastifyReplyError(400, err);
+ throw new FastifyReplyError(400, String(err), err);
});
}
if (this.meta.enableFC && this.meta.fcSecretKey) {
await this.captchaService.verifyFriendlyCaptcha(this.meta.fcSecretKey, body['frc-captcha-solution']).catch(err => {
- throw new FastifyReplyError(400, err);
+ throw new FastifyReplyError(400, String(err), err);
});
}
if (this.meta.enableTestcaptcha) {
await this.captchaService.verifyTestcaptcha(body['testcaptcha-response']).catch(err => {
- throw new FastifyReplyError(400, err);
+ throw new FastifyReplyError(400, String(err), err);
});
}
}
@@ -287,7 +287,7 @@ export class SignupApiService {
token: secret,
};
} catch (err) {
- throw new FastifyReplyError(400, typeof err === 'string' ? err : (err as Error).toString());
+ throw new FastifyReplyError(400, String(err), err);
}
}
}
@@ -356,7 +356,7 @@ export class SignupApiService {
return this.signinService.signin(request, reply, account as MiLocalUser);
} catch (err) {
- throw new FastifyReplyError(400, typeof err === 'string' ? err : (err as Error).toString());
+ throw new FastifyReplyError(400, String(err), err);
}
}
}