viafintech / camt_parser

A basic parser for camt.052, camt.053 and camt.054 files
MIT License
20 stars 24 forks source link

Introduce a CamtParser::Errors base class #46

Closed olleolleolle closed 2 years ago

olleolleolle commented 2 years ago

Hi!

I was looking at the collection of errors the Errors module.

All of them inherit directly from Ruby's StandardError.

What if they inherited from a class CamtParserError < StandardError exception class? That way, I'd be able to catch that one, in my application code.

tobischo commented 2 years ago

Hi @olleolleolle ,

you mean something like this:

module CamtParser
  module Errors
    class BaseError < StandardError; end

    class NamespaceAlreadyRegistered < BaseError; end
    class NotXMLError < BaseError; end
    class UnsupportedParserClass < BaseError; end
    class UnsupportedNamespaceError < BaseError; end
  end
end

?

olleolleolle commented 2 years ago

Yes, @tobischo!