Clean code, remove warning for future and spot
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Managing.Application.Abstractions;
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Managing.Domain.MoneyManagements;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -84,12 +83,12 @@ public class MoneyManagementController : BaseController
|
||||
{
|
||||
var user = await GetUser();
|
||||
var result = await _moneyManagementService.GetMoneyMangement(user, name);
|
||||
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return NotFound($"Money management strategy '{name}' not found");
|
||||
}
|
||||
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -110,12 +109,12 @@ public class MoneyManagementController : BaseController
|
||||
{
|
||||
var user = await GetUser();
|
||||
var result = await _moneyManagementService.DeleteMoneyManagement(user, name);
|
||||
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return NotFound($"Money management strategy '{name}' not found or could not be deleted");
|
||||
}
|
||||
|
||||
|
||||
return Ok(new { success = true, message = $"Money management strategy '{name}' deleted successfully" });
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Sentry;
|
||||
using System;
|
||||
|
||||
namespace Managing.Api.Controllers
|
||||
{
|
||||
@@ -26,22 +24,22 @@ namespace Managing.Api.Controllers
|
||||
{
|
||||
// Add breadcrumbs for context
|
||||
SentrySdk.AddBreadcrumb("About to capture test exception", "test");
|
||||
|
||||
|
||||
// Add context to the error
|
||||
SentrySdk.ConfigureScope(scope =>
|
||||
{
|
||||
scope.SetTag("test_type", "manual_exception");
|
||||
scope.SetExtra("timestamp", DateTime.Now);
|
||||
});
|
||||
|
||||
|
||||
// Log to both Serilog and Sentry
|
||||
_logger.LogError(ex, "Test exception captured in SentryTestController");
|
||||
|
||||
|
||||
// Explicitly capture exception
|
||||
SentrySdk.CaptureException(ex);
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
message = "Exception manually captured and sent to Sentry",
|
||||
exceptionMessage = ex.Message,
|
||||
timestamp = DateTime.Now
|
||||
@@ -53,7 +51,7 @@ namespace Managing.Api.Controllers
|
||||
public IActionResult ThrowException()
|
||||
{
|
||||
_logger.LogInformation("About to throw an uncaught exception");
|
||||
|
||||
|
||||
// This should be automatically captured by Sentry middleware
|
||||
throw new InvalidOperationException($"Uncaught exception from ThrowException endpoint - {DateTime.Now}");
|
||||
}
|
||||
@@ -63,12 +61,12 @@ namespace Managing.Api.Controllers
|
||||
{
|
||||
// Send a simple message to Sentry
|
||||
SentrySdk.CaptureMessage("Test message from Managing API", SentryLevel.Info);
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
message = "Test message sent to Sentry",
|
||||
timestamp = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user