Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ax] Add new error types so that it’s easier to avoid crashing #3

Merged
merged 1 commit into from
Apr 18, 2018

Conversation

hieuk09
Copy link
Contributor

@hieuk09 hieuk09 commented Apr 18, 2018

Context

We make a few requests from one application to another application for each request. For example, we call Exit when user clicks on deactivate in TPS or Engage.

With those external requests, it's a good practice that we don't crash our application given another application crash. For the above example, if Exit crashes, TINYpulse shouldn't crash. It should simply return an error instead.

However, some errors, such as Curl::Err::ConnectionFailedError is bubbling up from TinyClient to TINYpulse. While we can certainly catch those errors in TINYpulse, it's better if TinyClient provides a generic error type so that we don't have to care about the internal implementation of TinyClient.

Change

This PR addresses the above problem:

  • Creating a RequestError class to handle all errors related to making request. For example: if url is incorrect type, or not defined, or the internet connection is not up, ...
  • Creating a BaseError so that we have a proxy to reference to all errors of TinyClient instead of having to refer to each error.

@dinhhuydh
Copy link

👍

@hieuk09 hieuk09 merged commit 1fa8eb6 into master Apr 18, 2018
@hieuk09 hieuk09 deleted the feature/new-error branch April 18, 2018 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants