You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
590 B

import app from "@/global.js"
import BaseError from "./BaseError.js"
export default class ApiError extends BaseError {
constructor(message, status = ApiError.ERR_CODE.BAD_REQUEST) {
super(message, status)
this.name = "ApiError"
const ctx = app.currentContext
this.ctx = ctx
this.user = ctx?.state?.user || null
this.info = {
path: ctx?.path || "",
method: ctx?.method || "",
query: ctx?.query || {},
body: ctx?.request?.body || {},
params: ctx?.params || {},
}
}
}