We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 075134a commit 0e0653bCopy full SHA for 0e0653b
2 files changed
src/schemas/resolvers/BuildMutation.js
@@ -26,7 +26,10 @@ class BuildMutation {
26
.then(data => this.modelo
27
.query()
28
.deleteById(...this.params)
29
- .then(() => data))
+ .then((filas) => {
30
+ if (filas > 0) return data;
31
+ throw new Error(`El registro con el id ${this.params[0]} no se puede elmiar`);
32
+ }))
33
);
34
}
35
src/server.js
@@ -14,7 +14,14 @@ const PORT = 8080;
14
SERVER.use(
15
"/gql",
16
BodyParser.json(),
17
- graphqlExpress({ schema: Schema }),
+ graphqlExpress({
18
+ schema: Schema,
19
+ formatError: error => ({
20
+ errorCode: "A55",
21
+ name: error.name,
22
+ mensaje: error.message,
23
+ }),
24
25
/**
0 commit comments