@opengis/fastify-table
Version:
core-plugins
20 lines (16 loc) • 434 B
JavaScript
import applyHookSync from '../hook/funcs/applyHookSync.js';
function errorStatus(error) {
const hook = applyHookSync('errorStatus', error);
if (hook) return hook;
if (error.routine === 'exec_stmt_raise' && error.file === 'pl_exec.c') {
return 601;
}
if (error.routine === 'ExecConstraints') {
return 602;
}
if (error.type === 'DatabaseError') {
return 600;
}
return 500;
}
export default errorStatus;