Exception: QueryStream::DataLoadError

Inherits:
Error
  • Object
show all
Defined in:
lib/query_stream/errors.rb

Overview

データファイルの読み込みに失敗した (YAML/JSON 構文エラー、YAML で許可されていないクラス/タグ等)

セキュリティ設計:

YAML データファイルは `YAML.safe_load_file` で読み込まれ、
`!ruby/object` など危険な Ruby オブジェクトタグは
`Psych::DisallowedClass` として検出され、本例外に変換される。

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, file_path: nil, cause_error: nil) ⇒ DataLoadError

Returns a new instance of DataLoadError.



95
96
97
98
99
# File 'lib/query_stream/errors.rb', line 95

def initialize(msg = nil, file_path: nil, cause_error: nil)
  super(msg || "データファイルの読み込みに失敗しました: #{file_path}")
  @file_path = file_path
  @cause_error = cause_error
end

Instance Attribute Details

#cause_errorStandardError? (readonly)

元の例外(Psych::DisallowedClass 等)

Returns:

  • (StandardError, nil)

    the current value of cause_error



92
93
94
# File 'lib/query_stream/errors.rb', line 92

def cause_error
  @cause_error
end

#file_pathString (readonly)

読み込みに失敗したファイルパス

Returns:

  • (String)

    the current value of file_path



92
93
94
# File 'lib/query_stream/errors.rb', line 92

def file_path
  @file_path
end