def force_error_model(context, model_name='numpy'):
    """
    Temporarily change the context's error model.
    """
    from numba.core import callconv

    old_error_model = context.error_model
    context.error_model = callconv.create_error_model(model_name, context)
    try:
        yield
    finally:
        context.error_model = old_error_model

    Temporarily change the context's error model.
    
numba/core/imputils.py