Exception: Temporalio::Error::ApplicationError

Inherits:
Failure show all
Defined in:
lib/temporalio/error/failure.rb

Overview

Error raised during workflow/activity execution.

Defined Under Namespace

Modules: Category

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Temporalio::Error

canceled?

Constructor Details

#initialize(message, *details, type: nil, non_retryable: false, next_retry_delay: nil, category: Category::UNSPECIFIED) ⇒ ApplicationError

Create an application error.

Parameters:

  • message (String)

    Error message.

  • details (Array<Object, nil>)

    Error details.

  • type (String, nil) (defaults to: nil)

    Error type.

  • non_retryable (Boolean) (defaults to: false)

    Whether this error should be considered non-retryable.

  • next_retry_delay (Float, nil) (defaults to: nil)

    Specific amount of time to delay before next retry.

  • category (Category) (defaults to: Category::UNSPECIFIED)

    Error category.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/temporalio/error/failure.rb', line 60

def initialize(
  message,
  *details,
  type: nil,
  non_retryable: false,
  next_retry_delay: nil,
  category: Category::UNSPECIFIED
)
  super(message)
  @details = details
  @type = type
  @non_retryable = non_retryable
  @next_retry_delay = next_retry_delay
  @category = category
end

Instance Attribute Details

#categoryCategory (readonly)

Returns Error category.

Returns:



50
51
52
# File 'lib/temporalio/error/failure.rb', line 50

def category
  @category
end

#detailsArray<Object, nil> (readonly)

Returns User-defined details on the error.

Returns:

  • (Array<Object, nil>)

    User-defined details on the error.



35
36
37
# File 'lib/temporalio/error/failure.rb', line 35

def details
  @details
end

#next_retry_delayFloat? (readonly)

Returns Delay in seconds before the next activity retry attempt.

Returns:

  • (Float, nil)

    Delay in seconds before the next activity retry attempt.



47
48
49
# File 'lib/temporalio/error/failure.rb', line 47

def next_retry_delay
  @next_retry_delay
end

#non_retryableBoolean (readonly)

Note:

This is not whether the error is non-retryable via other means such as retry policy. This is just

whether the error was marked non-retryable upon creation by the user.

Returns:

  • (Boolean)

    Whether the error was set as non-retryable when created.



44
45
46
# File 'lib/temporalio/error/failure.rb', line 44

def non_retryable
  @non_retryable
end

#typeString? (readonly)

Returns General error type.

Returns:

  • (String, nil)

    General error type.



38
39
40
# File 'lib/temporalio/error/failure.rb', line 38

def type
  @type
end

Instance Method Details

#retryable?Boolean

Returns Inverse of #non_retryable.

Returns:



77
78
79
# File 'lib/temporalio/error/failure.rb', line 77

def retryable?
  !@non_retryable
end