<commit_before>module Onfido
  class RequestError < StandardError
    attr_accessor :type, :fields
  end
end<commit_msg>Add documentation as to how the request errors can be handled<commit_after>=begin
The class will handle response failures coming from Onfido
It's main purpose is to produce meaningful error messages to the user e.g.
RequestError: Authorization error: please re-check your credentials

Users can also rescue the error and insect its type and affected fields as
specified in the Onfido documentation e.g.

begin
  # error being raised
rescue Onfido::RequestError => e
  e.type
  e.fields
end

=end

module Onfido
  class RequestError < StandardError
    attr_accessor :type, :fields
  end
end
{'fraction_non_alphanumeric': 0.04366197183098591, 'fraction_numerical': 0.0, 'mean_word_length': 4.5984251968503935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7291046', 'n_tokens_mistral': 196, 'n_tokens_neox': 193, 'n_words': 90}