22 lines
634 B
TypeScript
22 lines
634 B
TypeScript
import { HttpStatusCode } from "@rocket.chat/apps-engine/definition/accessors";
|
|
import { SCIMError, SCIMErrorType } from "../scim/Error";
|
|
import { BaseError } from "./BaseError";
|
|
|
|
export class ConflictError extends BaseError {
|
|
public get message() {
|
|
return `This ${this.type} already exists`;
|
|
}
|
|
private type = "";
|
|
|
|
constructor(type: string) {
|
|
super();
|
|
this.type = type;
|
|
}
|
|
|
|
public toSCIMError(): SCIMError {
|
|
return new SCIMError()
|
|
.setStatus(HttpStatusCode.CONFLICT)
|
|
.setScimType(SCIMErrorType.INVALID_VALUE)
|
|
.setDetail(this.message);
|
|
}
|
|
}
|