mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 09:12:57 +02:00
feat(server): better api error messages (for unhandled exceptions) (#4817)
* feat(server): better error messages * chore: open api * chore: remove debug log * fix: syntax error * fix: e2e test
This commit is contained in:
parent
d4ef6f52bb
commit
2e424fe249
72 changed files with 1974 additions and 1952 deletions
mobile/openapi/lib/api
94
mobile/openapi/lib/api/authentication_api.dart
generated
94
mobile/openapi/lib/api/authentication_api.dart
generated
|
@ -16,53 +16,6 @@ class AuthenticationApi {
|
|||
|
||||
final ApiClient apiClient;
|
||||
|
||||
/// Performs an HTTP 'POST /auth/admin-sign-up' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [SignUpDto] signUpDto (required):
|
||||
Future<Response> adminSignUpWithHttpInfo(SignUpDto signUpDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/auth/admin-sign-up';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = signUpDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [SignUpDto] signUpDto (required):
|
||||
Future<AdminSignupResponseDto?> adminSignUp(SignUpDto signUpDto,) async {
|
||||
final response = await adminSignUpWithHttpInfo(signUpDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AdminSignupResponseDto',) as AdminSignupResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /auth/change-password' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
|
@ -315,6 +268,53 @@ class AuthenticationApi {
|
|||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /auth/admin-sign-up' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [SignUpDto] signUpDto (required):
|
||||
Future<Response> signUpAdminWithHttpInfo(SignUpDto signUpDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/auth/admin-sign-up';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = signUpDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [SignUpDto] signUpDto (required):
|
||||
Future<AdminSignupResponseDto?> signUpAdmin(SignUpDto signUpDto,) async {
|
||||
final response = await signUpAdminWithHttpInfo(signUpDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AdminSignupResponseDto',) as AdminSignupResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /auth/validateToken' operation and returns the [Response].
|
||||
Future<Response> validateAccessTokenWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue