mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -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,
|
||||
@Param('noteIdOrAlias', GetNotePipe) note: Note,
|
||||
): Promise<NoteMetadataDto> {
|
||||
try {
|
||||
if (!this.permissionsService.mayRead(user, note)) {
|
||||
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;
|
||||
if (!this.permissionsService.mayRead(user, note)) {
|
||||
throw new UnauthorizedException('Reading note denied!');
|
||||
}
|
||||
return await this.noteService.toNoteMetadataDto(note);
|
||||
}
|
||||
|
||||
@UseGuards(TokenAuthGuard)
|
||||
|
|
Loading…
Reference in a new issue