Skip to content

Errors Handling

Johann edited this page Dec 1, 2018 · 1 revision

Errors Handling

This project follows the one error to rule them all principle: all errors inherit from Knowledge::Error. That means you can rescue Knowledge::Error to catch all lib's errors. As Knowledge::Error inherits from StandardError, if you rescue StandardError, you'll catch all gem errors too.

Gem errors

Knowledge::AdapterNotFound

Thrown when we cannot find the adapter on which executing an operation. i.e: if you try to enable an adapter via the enable_adapter method before registering it, the gem will throw an AdapterNotFound error.

Knowledge::AdapterRunMethodNotImplemented

Thrown when an adapter inheriting from Knowledge::Adapters::Base does not override the run method.

Knowledge::LearnError

Thrown when the learning process leads to an error. It can occur when manipulating adapters, setter or during the gather! method execution.

Knowledge::RegisterError

Thrown when we failed registering an adapter.

Clone this wiki locally