ApiError missing .code in type for haveibeenpwned?

So I installed the HaveIBeenPwned plugin which works, but when handling the error which sets code to
PASSWORD_COMPROMISED
PASSWORD_COMPROMISED
it seems that ApiError type doesn't have the code property so i get a typescript error (but my code works). Am I missing something here or is this just a bug?
catch (e) {
error.value = e as APIError;

if (error.value.code === "PASSWORD_COMPROMISED") {
form.value?.setErrors([
{ name: "password", message: error.value.message },
]);
}
catch (e) {
error.value = e as APIError;

if (error.value.code === "PASSWORD_COMPROMISED") {
form.value?.setErrors([
{ name: "password", message: error.value.message },
]);
}
1 Reply
WiFi Plug
WiFi PlugOP3mo ago
I tried error.value.body?.code but body is undefined would it not make sense if instead of ApiError.code it was under ApiError.status like the PASSWORD_TOO_SHORT and PASSWORD_TOO_LONG statuses?

Did you find this page helpful?