Exception: Esbuild::BuildFailureError
- Inherits:
-
StandardError
- Object
- StandardError
- Esbuild::BuildFailureError
- Defined in:
- lib/esbuild/service.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(errors, warnings) ⇒ BuildFailureError
constructor
A new instance of BuildFailureError.
Constructor Details
#initialize(errors, warnings) ⇒ BuildFailureError
Returns a new instance of BuildFailureError.
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/esbuild/service.rb', line 261 def initialize(errors, warnings) @errors = errors @warnings = warnings summary = "" unless errors.empty? limit = 5 details = errors.slice(0, limit + 1).each_with_index.map do |error, index| break "\n..." if index == limit location = error["location"] break "\nerror: #{error["text"]}" unless location "\n#{location["file"]}:#{location["line"]}:#{location["column"]}: error: #{error["text"]}" end.join summary = "with #{errors.size} error#{errors.size > 1 ? "s" : ""}:#{details}" end super "Build failed#{summary}" end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
258 259 260 |
# File 'lib/esbuild/service.rb', line 258 def errors @errors end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
259 260 261 |
# File 'lib/esbuild/service.rb', line 259 def warnings @warnings end |