mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 17:44:27 -05:00
Public API: Remove superfluous try/catch
`getNoteMetadata` does not use a method that can throw a `PermissionsUpdateInconsistentError`. The try/catch-block seems to be a copy-paste error. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
83869aaa48
commit
ed8fd3939c
1 changed files with 3 additions and 10 deletions
|
@ -226,17 +226,10 @@ export class NotesController {
|
||||||
@RequestUser() user: User,
|
@RequestUser() user: User,
|
||||||
@Param('noteIdOrAlias', GetNotePipe) note: Note,
|
@Param('noteIdOrAlias', GetNotePipe) note: Note,
|
||||||
): Promise<NoteMetadataDto> {
|
): Promise<NoteMetadataDto> {
|
||||||
try {
|
if (!this.permissionsService.mayRead(user, note)) {
|
||||||
if (!this.permissionsService.mayRead(user, note)) {
|
throw new UnauthorizedException('Reading note denied!');
|
||||||
throw new UnauthorizedException('Reading note denied!');
|
|
||||||
}
|
|
||||||
return await this.noteService.toNoteMetadataDto(note);
|
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof PermissionsUpdateInconsistentError) {
|
|
||||||
throw new BadRequestException(e.message);
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
|
return await this.noteService.toNoteMetadataDto(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(TokenAuthGuard)
|
@UseGuards(TokenAuthGuard)
|
||||||
|
|
Loading…
Reference in a new issue