Exception: Rosette::Core::ExtractionSyntaxError
- Inherits:
-
StandardError
- Object
- StandardError
- Rosette::Core::ExtractionSyntaxError
- Defined in:
- lib/rosette/core/errors.rb
Overview
Represents a generic syntax error generated by one of Rosette’s extractors. Since extractors parse source code and other well-defined text formats, there’s always the possibility that these formats will contain syntax errors.
Instance Attribute Summary collapse
-
#commit_id ⇒ String
readonly
The commit id that contained the file that was being parsed when the error was generated.
-
#file ⇒ String
readonly
The file that was being parsed when the error was generated.
-
#language ⇒ Symbol
readonly
The source code language.
-
#original_exception ⇒ Exception
readonly
The original error from the parser or some such.
Instance Method Summary collapse
-
#initialize(msg, original_exception, language, file, commit_id) ⇒ ExtractionSyntaxError
constructor
Creates a new syntax error object.
-
#message ⇒ String
(also: #to_s)
A string representation of this error which includes the original message, the source language, the file, and the commit id.
Constructor Details
#initialize(msg, original_exception, language, file, commit_id) ⇒ ExtractionSyntaxError
Creates a new syntax error object.
72 73 74 75 76 77 78 79 |
# File 'lib/rosette/core/errors.rb', line 72 def initialize(msg, original_exception, language, file, commit_id) super(msg) @message = msg @original_exception = original_exception @language = language @file = file @commit_id = commit_id end |
Instance Attribute Details
#commit_id ⇒ String (readonly)
Returns the commit id that contained the file that was being parsed when the error was generated.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rosette/core/errors.rb', line 59 class ExtractionSyntaxError < StandardError attr_reader :original_exception, :language, :file, :commit_id # Creates a new syntax error object. # # @param [String] msg The error message text. # @param [Exception] original_exception The original error from the # parser or some such. # @param [Symbol] language The source code language. # @param [String] file The file that was being parsed when the error # was generated. # @param [String] commit_id The commit id that contained the file that # was being parsed when the error was generated. def initialize(msg, original_exception, language, file, commit_id) super(msg) @message = msg @original_exception = original_exception @language = language @file = file @commit_id = commit_id end # A string representation of this error which includes the original # message, the source language, the file, and the commit id. # # @return [String] def "#{@message}: #{original_exception.} (#{language}) in #{file} at #{commit_id}" end alias :to_s :message end |
#file ⇒ String (readonly)
Returns the file that was being parsed when the error was generated.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rosette/core/errors.rb', line 59 class ExtractionSyntaxError < StandardError attr_reader :original_exception, :language, :file, :commit_id # Creates a new syntax error object. # # @param [String] msg The error message text. # @param [Exception] original_exception The original error from the # parser or some such. # @param [Symbol] language The source code language. # @param [String] file The file that was being parsed when the error # was generated. # @param [String] commit_id The commit id that contained the file that # was being parsed when the error was generated. def initialize(msg, original_exception, language, file, commit_id) super(msg) @message = msg @original_exception = original_exception @language = language @file = file @commit_id = commit_id end # A string representation of this error which includes the original # message, the source language, the file, and the commit id. # # @return [String] def "#{@message}: #{original_exception.} (#{language}) in #{file} at #{commit_id}" end alias :to_s :message end |
#language ⇒ Symbol (readonly)
Returns the source code language.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rosette/core/errors.rb', line 59 class ExtractionSyntaxError < StandardError attr_reader :original_exception, :language, :file, :commit_id # Creates a new syntax error object. # # @param [String] msg The error message text. # @param [Exception] original_exception The original error from the # parser or some such. # @param [Symbol] language The source code language. # @param [String] file The file that was being parsed when the error # was generated. # @param [String] commit_id The commit id that contained the file that # was being parsed when the error was generated. def initialize(msg, original_exception, language, file, commit_id) super(msg) @message = msg @original_exception = original_exception @language = language @file = file @commit_id = commit_id end # A string representation of this error which includes the original # message, the source language, the file, and the commit id. # # @return [String] def "#{@message}: #{original_exception.} (#{language}) in #{file} at #{commit_id}" end alias :to_s :message end |
#original_exception ⇒ Exception (readonly)
Returns the original error from the parser or some such.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rosette/core/errors.rb', line 59 class ExtractionSyntaxError < StandardError attr_reader :original_exception, :language, :file, :commit_id # Creates a new syntax error object. # # @param [String] msg The error message text. # @param [Exception] original_exception The original error from the # parser or some such. # @param [Symbol] language The source code language. # @param [String] file The file that was being parsed when the error # was generated. # @param [String] commit_id The commit id that contained the file that # was being parsed when the error was generated. def initialize(msg, original_exception, language, file, commit_id) super(msg) @message = msg @original_exception = original_exception @language = language @file = file @commit_id = commit_id end # A string representation of this error which includes the original # message, the source language, the file, and the commit id. # # @return [String] def "#{@message}: #{original_exception.} (#{language}) in #{file} at #{commit_id}" end alias :to_s :message end |
Instance Method Details
#message ⇒ String Also known as: to_s
A string representation of this error which includes the original message, the source language, the file, and the commit id.
85 86 87 |
# File 'lib/rosette/core/errors.rb', line 85 def "#{@message}: #{original_exception.} (#{language}) in #{file} at #{commit_id}" end |