module Transcriptic class TranscripticError < StandardError class << self def status_code(code) define_method(:status_code) { code } define_singleton_method(:status_code) { code } end end alias_method :message, :to_s end class LabfileReadError < TranscripticError def initialize(original_error) @original_error = original_error end status_code(113) def status_code @original_error.respond_to?(:status_code) ? @original_error.status_code : 113 end def to_s [ "An error occurred while reading the Labfile:", "", " " + @original_error.to_s.split("\n").map(&:strip).join("\n "), ].join("\n") end end end