Exception: Voicevox::CoreError

Inherits:
Error
  • Object
show all
Defined in:
lib/voicevox/error.rb

Overview

Voicevoxのコアで発生したエラー。

Defined Under Namespace

Classes: CantGpuSupport, FailedExtractFullContextLabel, FailedGetSupportedDevices, FailedLoadMetas, FailedLoadModel, FailedParseKana, InferenceFailed, InvalidAudioQuery, InvalidModelIndex, InvalidSpeakerId, InvalidUtf8Input, NotLoadedOpenjtalkDict, UninitializedStatus

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCoreError

Returns a new instance of CoreError.



19
20
21
22
23
24
25
26
# File 'lib/voicevox/error.rb', line 19

def initialize
  message =
    Voicevox::Core.voicevox_error_result_to_message(
      self.class.code
    ).force_encoding("UTF-8")
  @code = code
  super(message)
end

Class Attribute Details

.codeObject (readonly)

Returns the value of attribute code.



29
30
31
# File 'lib/voicevox/error.rb', line 29

def code
  @code
end

Instance Attribute Details

#codeSymbol (readonly)

Returns エラーコード。.

Returns:

  • (Symbol)

    エラーコード。



17
18
19
# File 'lib/voicevox/error.rb', line 17

def code
  @code
end

Class Method Details

.from_code(code) ⇒ Object



31
32
33
34
35
36
# File 'lib/voicevox/error.rb', line 31

def from_code(code)
  ObjectSpace
    .each_object(Class)
    .find { |klass| klass < self && klass.code == code }
    .new
end