Exception: Zstd::Error

Inherits:
RuntimeError
  • Object
show all
Includes:
Exceptions
Defined in:
ext/extzstd.c

Instance Method Summary collapse

Constructor Details

#initialize(argv[], err) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'ext/extzstd.c', line 105

static VALUE
err_initialize(int argc, VALUE argv[], VALUE err)
{
    VALUE errcode;

    rb_scan_args(argc, argv, "1*", &errcode, NULL);
    rb_call_super(argc - 1, argv + 1);
    rb_ivar_set(err, id_error_code, errcode);

    return err;
}

Instance Method Details

#error_codeObject Also known as: errcode



117
118
119
120
121
# File 'ext/extzstd.c', line 117

static VALUE
err_errcode(VALUE err)
{
    return rb_ivar_get(err, id_error_code);
}

#to_sObject



123
124
125
126
127
128
129
130
# File 'ext/extzstd.c', line 123

static VALUE
err_to_s(VALUE err)
{
    ZSTD_ErrorCode code = (ZSTD_ErrorCode)NUM2SSIZET(rb_ivar_get(err, id_error_code));
    VALUE mesg = rb_call_super(0, NULL);
    VALUE mesg2 = rb_sprintf(" - %s (errcode: %d)", ZSTD_getErrorString(code), (int)code);
    return rb_str_plus(mesg, mesg2);
}