mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 10:16:32 -05:00
MarkdownBody: Handle error in getOwnPropertyDescriptor
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
a04a111293
commit
96f8284e64
1 changed files with 8 additions and 3 deletions
|
@ -42,15 +42,20 @@ export const MarkdownBody = createParamDecorator(
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
(target, key): void => {
|
(target, key): void => {
|
||||||
ApiConsumes('text/markdown')(
|
const ownPropertyDescriptor = Object.getOwnPropertyDescriptor(
|
||||||
target,
|
target,
|
||||||
key,
|
key,
|
||||||
Object.getOwnPropertyDescriptor(target, key),
|
|
||||||
);
|
);
|
||||||
|
if (!ownPropertyDescriptor) {
|
||||||
|
throw new Error(
|
||||||
|
`Could not get property descriptor for target ${target.toString()} and key ${key.toString()}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ApiConsumes('text/markdown')(target, key, ownPropertyDescriptor);
|
||||||
ApiBody({
|
ApiBody({
|
||||||
required: true,
|
required: true,
|
||||||
schema: { example: '# Markdown Body' },
|
schema: { example: '# Markdown Body' },
|
||||||
})(target, key, Object.getOwnPropertyDescriptor(target, key));
|
})(target, key, ownPropertyDescriptor);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue