Skip to main content

Error Handling & Status Code

  • Structural adjustments have been made to the error throws in the responses returned as a result of the requests made in the Symphony project.

  • For the new error management, the following Symphony version or a higher version should be used in Symphony projects.

    PackageVersion
    Symphony@stechquick/symphony@0.3.1
  • Before the update, errors occurring in the get, post, put, delete methods were thrown as Axios Errors as shown below. While managing errors within the catch block, access to the relevant fields was provided through the Axios Error object. image image

  • After the update, customers using fields that should not be accessed from the Axios error object within the catch block may encounter errors during the build process. To prevent these errors, they can continue to receive Axios errors as in the previous error management by adding the preserveNetworkError flag to the config.yaml file under 'sym-engine' as shown below.

    image

  • In cases where the preserveNetworkError flag is not present or set to false, a SymNetworkError will be received instead of an Axios error.. image

  • To proceed without encountering errors in any situation, the tryGet, tryPost, tryPut, and tryDelete methods have been used to prevent error throwing. For example, when a 404 error is received, the previous structure would throw an error, preventing the code from moving to the next line. However, with these new methods, operations can continue without throwing an error, and the status code can be accessed through SymNetworkError from the returned error.

    image image image

Warnings
  • With this version update, a minor change has been made, and the new version has been updated to 0.3.1. Before the next update, customers using Axios error need to change their usage structures here. The preserveNetworkError flag will be removed, and a major change will be made later, with a new version being released.

  • Information about encountering errors during the build process:

    • Axios error fields have been masked, and direct access to Axios error is no longer provided to users. A major transition to a new version will be made soon. Axios currently creates a dependency in the structure, and in the future, situations such as the complete removal of Axios or version updates may be encountered, which could cause errors in existing projects. Therefore, changes have been made to the Axios error handling structure here. At this point, a structure needs to be established where all errors are read through Symphony.

    • To prevent errors encountered during the build and to continue using Axios error, you can add the preserveNetworkError: true flag in the config.yaml file under the sym-engine directory. Soon, this flag will be removed, and it is requested to proceed with SymNetworkError returned from Symphony instead of using Axios error in the error handling method.

      image