forked from gongxuegit/tiku-backend.net
feat: add learning activity endpoints
This commit is contained in:
@@ -4,6 +4,7 @@ using Tiku.Application.Assets;
|
||||
using Tiku.Application.Auth;
|
||||
using Tiku.Application.Storage;
|
||||
using Tiku.Infrastructure.Content;
|
||||
using Tiku.Infrastructure.Learning;
|
||||
using Tiku.Infrastructure.QuestionBanks;
|
||||
|
||||
namespace Tiku.Api.Middleware;
|
||||
@@ -87,6 +88,36 @@ public sealed class ExceptionHandlingMiddleware(
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception is LearningValidationException learningValidationException)
|
||||
{
|
||||
await WriteProblemAsync(
|
||||
context,
|
||||
learningValidationException.Message,
|
||||
StatusCodes.Status400BadRequest,
|
||||
learningValidationException.Code);
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception is LearningResourceNotFoundException learningResourceNotFoundException)
|
||||
{
|
||||
await WriteProblemAsync(
|
||||
context,
|
||||
learningResourceNotFoundException.Message,
|
||||
StatusCodes.Status404NotFound,
|
||||
learningResourceNotFoundException.Code);
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception is LearningAccessDeniedException)
|
||||
{
|
||||
await WriteProblemAsync(
|
||||
context,
|
||||
exception.Message,
|
||||
StatusCodes.Status403Forbidden,
|
||||
"learning_access_denied");
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception is ObjectStorageException storageException)
|
||||
{
|
||||
await WriteProblemAsync(
|
||||
|
||||
Reference in New Issue
Block a user