refactor(Document-, EnvelopeController): Globale try-catch-Anweisungen entfernen
This commit is contained in:
parent
730a318b56
commit
903e4678ed
@ -29,8 +29,6 @@ public class DocumentController : BaseController
|
|||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<IActionResult> Get([FromRoute] string envelopeKey, [FromQuery] int index)
|
public async Task<IActionResult> Get([FromRoute] string envelopeKey, [FromQuery] int index)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Validate Envelope Key and load envelope
|
// Validate Envelope Key and load envelope
|
||||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||||
@ -45,19 +43,11 @@ public class DocumentController : BaseController
|
|||||||
// Return the document as bytes
|
// Return the document as bytes
|
||||||
return File(bytes, "application/octet-stream");
|
return File(bytes, "application/octet-stream");
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "{Message}", ex.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("{envelopeKey}")]
|
[HttpPost("{envelopeKey}")]
|
||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
public async Task<IActionResult> Open(string envelopeKey)
|
public async Task<IActionResult> Open(string envelopeKey)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var authSignature = this.GetAuthReceiverSignature();
|
var authSignature = this.GetAuthReceiverSignature();
|
||||||
|
|
||||||
@ -72,10 +62,4 @@ public class DocumentController : BaseController
|
|||||||
|
|
||||||
return Ok(new object());
|
return Ok(new object());
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "{Message}", ex.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -46,8 +46,6 @@ public class EnvelopeController : BaseController
|
|||||||
[NonAction]
|
[NonAction]
|
||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
public async Task<IActionResult> Get([FromRoute] string envelopeKey)
|
public async Task<IActionResult> Get([FromRoute] string envelopeKey)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
envelopeKey = _urlEncoder.Encode(envelopeKey);
|
envelopeKey = _urlEncoder.Encode(envelopeKey);
|
||||||
|
|
||||||
@ -64,19 +62,11 @@ public class EnvelopeController : BaseController
|
|||||||
_logger.LogInformation("Loaded envelope [{0}] for receiver [{1}]", response.Envelope.Id, response.Envelope.Id);
|
_logger.LogInformation("Loaded envelope [{0}] for receiver [{1}]", response.Envelope.Id, response.Envelope.Id);
|
||||||
return Json(response);
|
return Json(response);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_logger.LogError(e, "{Message}", e.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("{envelopeKey}")]
|
[HttpPost("{envelopeKey}")]
|
||||||
[Obsolete("Use MediatR")]
|
[Obsolete("Use MediatR")]
|
||||||
public async Task<IActionResult> Update(string envelopeKey, int index)
|
public async Task<IActionResult> Update(string envelopeKey, int index)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
envelopeKey = _urlEncoder.Encode(envelopeKey);
|
envelopeKey = _urlEncoder.Encode(envelopeKey);
|
||||||
|
|
||||||
@ -111,24 +101,16 @@ public class EnvelopeController : BaseController
|
|||||||
|
|
||||||
return Ok(new object());
|
return Ok(new object());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_logger.LogError(e, "{Message}", e.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
[Authorize(Roles = ReceiverRole.FullyAuth)]
|
||||||
[HttpPost("reject")]
|
[HttpPost("reject")]
|
||||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||||
public async Task<IActionResult> Reject([FromBody] string? reason = null)
|
public async Task<IActionResult> Reject([FromBody] string? reason = null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var signature = this.GetAuthReceiverSignature();
|
var signature = this.GetAuthReceiverSignature();
|
||||||
var uuid = this.GetAuthEnvelopeUuid();
|
var uuid = this.GetAuthEnvelopeUuid();
|
||||||
var mail = this.GetAuthReceiverMail();
|
var mail = this.GetAuthReceiverMail();
|
||||||
if(uuid is null || signature is null || mail is null)
|
if (uuid is null || signature is null || mail is null)
|
||||||
{
|
{
|
||||||
_logger.LogEnvelopeError(uuid: uuid, signature: signature,
|
_logger.LogEnvelopeError(uuid: uuid, signature: signature,
|
||||||
message: @$"Unauthorized POST request in api\envelope\reject. One of claims, Envelope, signature or mail ({mail}) is null.");
|
message: @$"Unauthorized POST request in api\envelope\reject. One of claims, Envelope, signature or mail ({mail}) is null.");
|
||||||
@ -152,10 +134,4 @@ public class EnvelopeController : BaseController
|
|||||||
return this.ViewInnerServiceError();
|
return this.ViewInnerServiceError();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
_logger.LogError(e, "{Message}", e.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user