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.



70
71
72
73
74
# File 'lib/query_stream/errors.rb', line 70

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



67
68
69
# File 'lib/query_stream/errors.rb', line 67

def cause_error
  @cause_error
end

#file_pathString (readonly)

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

Returns:

  • (String)

    the current value of file_path



67
68
69
# File 'lib/query_stream/errors.rb', line 67

def file_path
  @file_path
end