export class SpringApiError extends ApiError {
readonly timestamp: string;
readonly path: string;
constructor(dto: ServerErrorDto) {
super(dto.status, dto.message);
this.timestamp = dto.timestamp;
this.name = dto.error;
this.path = dto.path;
}
toString() {
return `
${this.stack} | ${this.name} | ${this.message}
`
}
}
interface ServerErrorDto {
timestamp?: string,
status: number,
error: string
message: string
path?: string
}
出于某种原因,仅仅扩展 ApiError
会给我一个来自 etag
模块的错误。
任何想法为什么?
这正常吗?
我可能只是在找课……我很高兴扩展 Error
。