mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 17:34:28 -05:00
MarkdownBody: Handle error in getOwnPropertyDescriptor
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
4959be739a
commit
a453344205
1 changed files with 8 additions and 3 deletions
|
@ -42,15 +42,20 @@ export const MarkdownBody = createParamDecorator(
|
|||
},
|
||||
[
|
||||
(target, key): void => {
|
||||
ApiConsumes('text/markdown')(
|
||||
const ownPropertyDescriptor = Object.getOwnPropertyDescriptor(
|
||||
target,
|
||||
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({
|
||||
required: true,
|
||||
schema: { example: '# Markdown Body' },
|
||||
})(target, key, Object.getOwnPropertyDescriptor(target, key));
|
||||
})(target, key, ownPropertyDescriptor);
|
||||
},
|
||||
],
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue