diff --git a/src/lib/errors/HTTPErrors/DocumentNotFound.ts b/src/lib/errors/Imperial/DocumentNotFound.ts similarity index 100% rename from src/lib/errors/HTTPErrors/DocumentNotFound.ts rename to src/lib/errors/Imperial/DocumentNotFound.ts diff --git a/src/lib/errors/HTTPErrors/NotAllowed.ts b/src/lib/errors/Imperial/EditNotAllowed.ts similarity index 100% rename from src/lib/errors/HTTPErrors/NotAllowed.ts rename to src/lib/errors/Imperial/EditNotAllowed.ts diff --git a/src/lib/errors/Imperial/WrongPassword.ts b/src/lib/errors/Imperial/WrongPassword.ts new file mode 100644 index 0000000..a1f43d9 --- /dev/null +++ b/src/lib/errors/Imperial/WrongPassword.ts @@ -0,0 +1,10 @@ +import { ImperialError } from "../ImperialError"; + +export class WrongPassword extends ImperialError { + constructor(...args: ConstructorParameters) { + super(...args); + + this.message = "You need to provide a password, since this document is encrypted!"; + this.status = 401; + } +} diff --git a/src/lib/errors/index.ts b/src/lib/errors/index.ts index 9422cef..afc0635 100644 --- a/src/lib/errors/index.ts +++ b/src/lib/errors/index.ts @@ -1,5 +1,6 @@ -export { DocumentNotFound } from "./HTTPErrors/DocumentNotFound"; -export { NotAllowed } from "./HTTPErrors/NotAllowed"; +export { DocumentNotFound } from "./Imperial/DocumentNotFound"; export { ImperialError } from "./ImperialError"; export { Aborted } from "./HTTPErrors/Aborted"; export { FailedToFetch } from "./HTTPErrors/FailedToFetch"; +export { NotAllowed } from "./Imperial/EditNotAllowed"; +export { WrongPassword } from "./Imperial/WrongPassword";