473,625 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Raising errors - errornumbers

Hi!

I often raise my own errors in code, and I just use ErrorNumber 1, since I
do not use this number for anything (like maintaining a table of
errornumbers or whatever).

I then started wondering... Is this an okay use of raising errors? Should I
use a certain range of numbers for some reason? Is there a best practice for
raising errors - things to consider?

- Klaus
Nov 20 '05 #1
1 1410
Hello,

"Klaus Jensen" <msnews2@icatec h..dk> schrieb:
I often raise my own errors in code, and I just use
ErrorNumber 1, since I do not use this number
for anything (like maintaining a table of
errornumbers or whatever).

I then started wondering... Is this an okay use of
raising errors? Should I use a certain range of
numbers for some reason? Is there a best practice for
raising errors - things to consider?


http://msdn.microsoft.com/library/en...vamthraise.asp

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
20762
by: NavyJay | last post by:
I have a simple for-loop, which instantiates a class object each iteration. As part of my class constructor, __init__(), I check for valid input settings. If there is a problem with this iteration, I want to abort the loop, but equivalently 'continue' on in the for-loop. I can't use 'break' or 'continue' in a class method, nor can I return a boolean value from __init__() to check for errors within the for-loop. How would I be able to...
1
4330
by: Jen S | last post by:
I feel like I'm missing something obvious here, but I'm stumped... I have a stored procedure with code that looks like: INSERT INTO MyTableA ( ...fields... ) VALUES (...values...) IF (@@ERROR <> 0) BEGIN ROLLBACK TRANSACTION; RAISERROR('An error occurred in the stored proc.', 16, 1);
0
1646
by: spe.stani.be | last post by:
SPE (Stani's Python Editor) is an open-source python IDE with auto indentation & completion, call tips, syntax coloring & highlighting, UML diagrams, class explorer, source index, auto todo list, sticky notes, pycrust shell, file browsers, drag&drop, context help, Blender support, ... Spe ships with Python debugger (remote & encrypted), wxGlade (gui designer), PyChecker (source code doctor) and Kiki (regex console). To support the...
6
2860
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a TimerState object similar to the example in the System.Threading.Timer documentation. The method which handles the timer events, among other things, periodically calls a method in this TimerState object which raises an event to the startup form,...
2
1152
by: Jason | last post by:
I want to raise custom errors. For instance, when my File class tries to copy a file, I check to make sure the file is available (by trying to get an exclusive lock on it). I try for a specific period of time, and if the file doesn't become available I want to throw an error stating something like "File not available". Since I will be re-using this functionality (of throwing custom errors) I'd like to create a class. Anyone got any code...
2
1725
by: Axel Dahmen | last post by:
Hi, I've added a couple of validators to my page. Now I get a couple of Runtime Errors when I load the page (I have "Show client-script errors" enabled in IE6): "A Runtime Error has occurred. Do you wish to debug? Line: ... Error: Expected ';'" This shouldn't happen. Adding the validators to the pages has changed
2
1801
by: davidz | last post by:
When a catchable error occurs in a try block, control is passed to the associated catch block. While I am then able to examine properties of the error using such functions as ERROR_NUMBER() in the catch block, the error-logging scheme used in my company requires that the actual error be raised so that it can be picked up by components in the next tier. I appear to be unable to do that -- I can raise some other error that has all of the...
4
3247
by: python | last post by:
Bad file names, i.e. filenames the OS considers illegal, will cause functions in the os.path module to raise an error. Example: import os.path print os.path.getsize( 'c:/pytest/*.py' ) On Windows XP using Python 2.5.2 I get the following traceback:
26
1648
by: buu | last post by:
So, let's say that a user enters an event name in text box, and would like to raise it.. is it possible to call events by their 'name'? Is it possible to enumerate events inside app. and to check their names?
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.