Questions tagged [raiseerror]

54 questions
11
votes
1 answer

Rollback and Raiseerror, which first?

I sometimes perform the following set of statement in the following order: Raiseerror(...) Rollback; but I am wondering if it cause the same effect as below: Rollback; Raiseerror(...) I understand they are the same and cause the same effect. Doing…
Willy
  • 9,848
  • 22
  • 141
  • 284
4
votes
2 answers

How to raise error for nan value in python numpy

I need to automatically raise an error, if I divide by zero in numpy array using the "/" operator, or better if I do any operation, that results in nan. What numpy does instead is to return nan value. I do not need my program to run after that,…
4
votes
0 answers

AWS CDK - Raise error if a key is missing from secrets Manager

I can create and use an AWS SecretsManager store Key value pair. Let's say you want to raise an error if the key does not exist inside AWS SecretsManager. const secretKey = "keyNameInAWS"; //Below is used for any resource that takes SecretValue as…
scope
  • 61
  • 1
  • 8
4
votes
2 answers

Raiseerror and Concat for the Message

I'd like to do something like this raiserror(concat('Error in case @isFishy =', @isFishy, ' @isSmarmy=', @isSmarmy, ' @isTasty = ', @isTasty), 10, 1) --or raiserror('Error in case @isFishy =' + @isFishy + ' @isSmarmy=' + @isSmarmy + ' @isTasty = '…
Tom Ritter
  • 99,986
  • 30
  • 138
  • 174
4
votes
1 answer

Rspec expect raise_error ObjectDisabledException throws NameError exception

I have been using the watirspec-master files as examples to write my own RSpec tests. I recently encountered a situation in which I need to test for an exception thrown by a click or set event. I wrote the following test based on code in the…
Helioza
  • 147
  • 1
  • 1
  • 8
3
votes
1 answer

What happens here? SQL Server - XACT_ABORT ON + @@ERROR Checking . .

What happens with this type of scenario? SET XACT_ABORT ON BEGIN TRANSACTION ---DO SOMETHING HERE THAT CAUSES AN ERROR COMMIT TRANSACTION if @@error != 0 raiserror('SP failed. Step 7.', 20, -1) with log GO My guess is that because…
richard
  • 12,263
  • 23
  • 95
  • 151
3
votes
1 answer

SQL GOTO statement in a script with multiple GO

I need to exit a SQL script without an error if a certain condition holds true. I've read that 1 solution would be to raiseerror with error code 20+ and with log parameter. But the limitation for that is that i can execute that only as an admin and…
kateroh
  • 4,382
  • 6
  • 43
  • 62
3
votes
1 answer

RaiseError Command in T-SQL

So I was trying to put in a RaisError statement earlier today, and accidentally put it in as follows: RaiseError ('Some error message', 16, -1) Note the extra e. Naturally, it threw an error, as it was meant to be RaisError, but what caught me…
Siyual
  • 16,415
  • 8
  • 44
  • 58
3
votes
5 answers

Skip validation on few fields

I have model patient. When patient try to register, he fills fields, for example: name, email, telephone, and there is validation presence on this fields. Also i have another form in which doctor can add patient for himself, this form has only one…
yozzz
  • 1,267
  • 1
  • 22
  • 30
2
votes
4 answers

SQL Server: Raiserror where @variable = true

I can't seem to work this out. I want to kill my script if a variable is true. but I can't find any answers so far. What I'm trying: raiserror('Error', 18, -1) Where @Variable='True'; I have declared and assigned the variable already
Jasper
  • 31
  • 2
2
votes
4 answers

Ruby assign a variable or raise error if nil

In kotlin and C#, you can assign a variable, or else if the value is nil, you can throw an exception using the ?: and ?? operators. For example, in C#: var targetUrl = GetA() ?? throw new Exception("Missing A"); // alt var targetUrl = GetA() ??…
Orion Edwards
  • 121,657
  • 64
  • 239
  • 328
2
votes
1 answer

Why does 'raised Error' work, but 'assert' doesn't?

There is a difference when I use assert and raised ValuError, why? The following code, only stop my script when I use raise ValueError, assert does not work. assert (len(dictA) != len(dictB)), 'Your have an .... error' if len(dictA) !=…
gusa10
  • 169
  • 1
  • 1
  • 10
2
votes
1 answer

Odoo: ValueError("Expected singleton: %s" % self)

I'm modifying Odoo OpenEduCat exam module to fit the need of my institution. For that, I have tailored the code as shown below. However,when I click on generate button, odoo raises expected singleton error. Generating button Error details --Python…
2
votes
1 answer

How to get the message of RaiseError of a procedure in another procedure

I have two procedures PROC_A and PROC_B. In both procedure transaction are managed. PROC_B throws an error by calling RAISEERROR and passes a message in certain condition RAISERROR ('Initiator is Inactive', 16, 1, 'Approve Transaction'); I am…
user3048027
  • 387
  • 1
  • 5
  • 24
2
votes
1 answer

Set number and message for RAISERROR in stored procedure

I wrote a stored procedure that saves card. I want to when Barcode_Num is duplicate, don't allow for adding and display message (I know that must use from RAISERROR), but I want set the number for RAISERROR and set message that is: the card number…
user User
  • 41
  • 1
  • 8
1
2 3 4