api_exception 1.1.3 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aeefc2868036a903c5bf6f66723a5e25a7cd422a7922a34cb67f715a9c83a96f
4
- data.tar.gz: c8577f4396e3405903c615a6a04455ef47b6ef302968f9ea1ea7da830848f23e
3
+ metadata.gz: 27f04c16cb291109915c1ea4787587cc66fb40841121b4844c3c4dbd117b2582
4
+ data.tar.gz: 5996cc49ba242dbc5b7d316bceb61358efe72215660be16cbb47a11180787012
5
5
  SHA512:
6
- metadata.gz: 683d5ca3828d37482ae74f8641180faba8b857f202895f5ea6ad77f9c12a5393b7a6b2328ed08eb578d9fcbec93db29419ae22b2a170cc2a056f7cab50aa5b66
7
- data.tar.gz: 31ac7672a69b290f52378021e5aba39508f17617521a67542cec546605b24c6a5d04b580f166452eb122d49687d110a405a3be1953727dc723d05d87f6b0c2d2
6
+ metadata.gz: 9302833bc0e8e1f5d820d75e624d79dce16f42c39eb9d71299f4a4753b6d52aefdb3ef5a536aa1673edf3635d32afdea6c3dc3997a3cfd1b821c7c483a63f45e
7
+ data.tar.gz: fa67d0509d5c19b635d54dd03fb11c136ca00a318d0f6b4856a8d2389e7973b21e1bd908884fb5a58b8081f953d8cf88ef6ad84bbb7300a9ca48877c9f3ce1db
@@ -38,4 +38,13 @@ en:
38
38
  authentication_error: The user could not be authenticated
39
39
  permission_denied: The user does not have the permissions to perform this action
40
40
  insecure_password_storage: The password must be strong
41
- profile_update_error: The user data could not be updated
41
+ profile_update_error: The user data could not be updated
42
+ service_exceptions:
43
+ invalid_parameters: The parameters provided to the service are invalid
44
+ business_logic_error: Business logic error in the service
45
+ transaction_error: An error occurred during the service transaction
46
+ missing_required_parameter: A required parameter is missing to execute the service
47
+ service_execution_failed: Service execution failed
48
+ invalid_context: The provided context is not valid for this operation
49
+ dependency_error: Error in the dependencies required by the service
50
+ validation_error: Validation error in the service
@@ -39,3 +39,12 @@ es:
39
39
  permission_denied: El usuario no cuenta con los permisos para realizar esta acción
40
40
  insecure_password_storage: La contraseña debe ser segura
41
41
  profile_update_error: No fue posible actualizar los datos del usuario
42
+ service_exceptions:
43
+ invalid_parameters: Los parámetros proporcionados al servicio no son válidos
44
+ business_logic_error: Error en la lógica de negocio del servicio
45
+ transaction_error: Ocurrió un error durante la transacción del servicio
46
+ missing_required_parameter: Falta un parámetro requerido para ejecutar el servicio
47
+ service_execution_failed: La ejecución del servicio falló
48
+ invalid_context: El contexto proporcionado no es válido para esta operación
49
+ dependency_error: Error en las dependencias requeridas por el servicio
50
+ validation_error: Error de validación en el servicio
@@ -0,0 +1,29 @@
1
+ module ApiException
2
+ class ServiceException < BaseException
3
+
4
+ def initialize(error_type, errors, params = {}, platform = "API")
5
+ super
6
+ end
7
+
8
+ private
9
+
10
+ # Service error code should between 601 and 700
11
+ def error_code_map
12
+ {
13
+ INVALID_PARAMETERS: { code: 601, message: find_translation(:invalid_parameters) },
14
+ BUSINESS_LOGIC_ERROR: { code: 602, message: find_translation(:business_logic_error) },
15
+ TRANSACTION_ERROR: { code: 603, message: find_translation(:transaction_error) },
16
+ MISSING_REQUIRED_PARAMETER: { code: 604, message: find_translation(:missing_required_parameter) },
17
+ SERVICE_EXECUTION_FAILED: { code: 605, message: find_translation(:service_execution_failed) },
18
+ INVALID_CONTEXT: { code: 606, message: find_translation(:invalid_context) },
19
+ DEPENDENCY_ERROR: { code: 607, message: find_translation(:dependency_error) },
20
+ VALIDATION_ERROR: { code: 608, message: find_translation(:validation_error) },
21
+ }
22
+ end
23
+
24
+ def find_translation(error)
25
+ I18n.t("service_exceptions.#{error.to_s}")
26
+ end
27
+ end
28
+ end
29
+
@@ -2,5 +2,5 @@ module ApiException
2
2
  # first number stable version
3
3
  # second number major release
4
4
  # bug fixes or minor release
5
- VERSION = "1.1.3"
5
+ VERSION = "1.2.3"
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_exception
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - killjoy
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-04-01 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -44,6 +43,7 @@ files:
44
43
  - lib/api_exception/file_exception.rb
45
44
  - lib/api_exception/model_exception.rb
46
45
  - lib/api_exception/request_exception.rb
46
+ - lib/api_exception/service_exception.rb
47
47
  - lib/api_exception/user_exception.rb
48
48
  - lib/api_exception/version.rb
49
49
  homepage: https://gitlab.com/code-nest2/api_exception
@@ -53,7 +53,6 @@ metadata:
53
53
  homepage_uri: https://gitlab.com/code-nest2/api_exception
54
54
  source_code_uri: https://gitlab.com/code-nest2/api_exception
55
55
  changelog_uri: https://gitlab.com/code-nest2/api_exception/-/blob/main/README.md?ref_type=heads
56
- post_install_message:
57
56
  rdoc_options: []
58
57
  require_paths:
59
58
  - lib
@@ -68,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
67
  - !ruby/object:Gem::Version
69
68
  version: '0'
70
69
  requirements: []
71
- rubygems_version: 3.5.6
72
- signing_key:
70
+ rubygems_version: 3.6.9
73
71
  specification_version: 4
74
72
  summary: Simple Exception handle
75
73
  test_files: []