X64 Exception Type 0d

0 views
Skip to first unread message

Bridgette Kubis

unread,
Aug 5, 2024, 7:07:15 AM8/5/24
to cesshighkuptbulk
Builtin exceptions are the exceptions that are available in Java libraries. These exceptions are suitable to explain certain error situations. Below is the list of important built-in exceptions in Java.

I. IllegalArgumentException: This program, checks whether the person is eligible for voting or not. If the age is greater than or equal to 18 then it will not throw any error. If the age is less than 18 then it will throw an error with the error statement.


J. IllegalStateException: This program, displays the addition of numbers only for Positive integers. If both the numbers are positive then only it will call the print method to print the result otherwise it will throw the IllegalStateException with an error statement. Here, the method is not accessible for non-positive integers.


The built-in exception classes can be subclassed to define new exceptions;programmers are encouraged to derive new exceptions from the Exceptionclass or one of its subclasses, and not from BaseException. Moreinformation on defining exceptions is available in the Python Tutorial underUser-defined Exceptions.


The expression following from must be an exception or None. Itwill be set as __cause__ on the raised exception. Setting__cause__ also implicitly sets the __suppress_context__attribute to True, so that using raise new_exc from Noneeffectively replaces the old exception with the new one for displaypurposes (e.g. converting KeyError to AttributeError), whileleaving the old exception available in __context__ for introspectionwhen debugging.


The default traceback display code shows these chained exceptions inaddition to the traceback for the exception itself. An explicitly chainedexception in __cause__ is always shown when present. An implicitlychained exception in __context__ is shown only if __cause__is None and __suppress_context__ is false.


The base class for all built-in exceptions. It is not meant to be directlyinherited by user-defined classes (for that, use Exception). Ifstr() is called on an instance of this class, the representation ofthe argument(s) to the instance are returned, or the empty string whenthere were no arguments.


The tuple of arguments given to the exception constructor. Some built-inexceptions (like OSError) expect a certain number of arguments andassign a special meaning to the elements of this tuple, while others areusually called only with a single string giving an error message.


This method sets tb as the new traceback for the exception and returnsthe exception object. It was more commonly used before the exceptionchaining features of PEP 3134 became available. The following exampleshows how we can convert an instance of SomeException into aninstance of OtherException while preserving the traceback. Onceraised, the current frame is pushed onto the traceback of theOtherException, as would have happened to the traceback of theoriginal SomeException had we allowed it to propagate to the caller.


The name and obj attributes can be set using keyword-onlyarguments to the constructor. When set they represent the name of the attributethat was attempted to be accessed and the object that was accessed for saidattribute, respectively.


Raised when the user hits the interrupt key (normally Control-C orDelete). During execution, a check for interrupts is maderegularly. The exception inherits from BaseException so as to not beaccidentally caught by code that catches Exception and thus preventthe interpreter from exiting.


Catching a KeyboardInterrupt requires special consideration.Because it can be raised at unpredictable points, it may, in somecircumstances, leave the running program in an inconsistent state. It isgenerally best to allow KeyboardInterrupt to end the program asquickly as possible or avoid raising it entirely. (SeeNote on Signal Handlers and Exceptions.)


This exception is derived from RuntimeError. In user defined baseclasses, abstract methods should raise this exception when they requirederived classes to override the method, or while the class is beingdeveloped to indicate that the real implementation still needs to be added.


The second form of the constructor sets the corresponding attributes,described below. The attributes default to None if notspecified. For backwards compatibility, if three arguments are passed,the args attribute contains only a 2-tupleof the first two constructor arguments.


The constructor often actually returns a subclass of OSError, asdescribed in OS exceptions below. The particular subclass depends onthe final errno value. This behaviour only occurs whenconstructing OSError directly or via an alias, and is notinherited when subclassing.


Under Windows, if the winerror constructor argument is an integer,the errno attribute is determined from the Windows error code,and the errno argument is ignored. On other platforms, thewinerror argument is ignored, and the winerror attributedoes not exist.


For exceptions that involve a file system path (such as open() oros.unlink()), filename is the file name passed to the function.For functions that involve two file system paths (such asos.rename()), filename2 corresponds to the secondfile name passed to the function.


Changed in version 3.4: The filename attribute is now the original file name passed tothe function, instead of the name encoded to or decoded from thefilesystem encoding and error handler. Also, the filename2constructor argument and attribute was added.


Raised when the result of an arithmetic operation is too large to berepresented. This cannot occur for integers (which would rather raiseMemoryError than give up). However, for historical reasons,OverflowError is sometimes raised for integers that are outside a requiredrange. Because of the lack of standardization of floating-point exceptionhandling in C, most floating-point operations are not checked.


This exception is raised when a weak reference proxy, created by theweakref.proxy() function, is used to access an attribute of the referentafter it has been garbage collected. For more information on weak references,see the weakref module.


Raised when the parser encounters a syntax error. This may occur in animport statement, in a call to the built-in functionscompile(), exec(),or eval(), or when reading the initial script or standard input(also interactively).


Raised when the interpreter finds an internal error, but the situation does notlook so serious to cause it to abandon all hope. The associated value is astring indicating what went wrong (in low-level terms).


A call to sys.exit() is translated into an exception so that clean-uphandlers (finally clauses of try statements) can beexecuted, and so that a debugger can execute a script without running the riskof losing control. The os._exit() function can be used if it isabsolutely positively necessary to exit immediately (for example, in the childprocess after a call to os.fork()).


This exception may be raised by user code to indicate that an attemptedoperation on an object is not supported, and is not meant to be. If an objectis meant to support a given operation but has not yet provided animplementation, NotImplementedError is the proper exception to raise.


Passing arguments of the wrong type (e.g. passing a list when anint is expected) should result in a TypeError, but passingarguments with the wrong value (e.g. a number outside expected boundaries)should result in a ValueError.


A subclass of ConnectionError, raised when trying to write on apipe while the other end has been closed, or trying to write on a socketwhich has been shutdown for writing.Corresponds to errno EPIPE and ESHUTDOWN.


Changed in version 3.5: Python now retries system calls when a syscall is interrupted by asignal, except if the signal handler raises an exception (see PEP 475for the rationale), instead of raising InterruptedError.


Raised when a directory operation (such as os.listdir()) is requested onsomething which is not a directory. On most POSIX platforms, it may also beraised if an operation attempts to open or traverse a non-directory file as ifit were a directory.Corresponds to errno ENOTDIR.


The following are used when it is necessary to raise multiple unrelatedexceptions. They are part of the exception hierarchy so they can behandled with except like all other exceptions. In addition,they are recognised by except*, which matchestheir subgroups based on the types of the contained exceptions.


Both of these exception types wrap the exceptions in the sequence excs.The msg parameter must be a string. The difference between the twoclasses is that BaseExceptionGroup extends BaseException andit can wrap any exception, while ExceptionGroup extends Exceptionand it can only wrap subclasses of Exception. This design is so thatexcept Exception catches an ExceptionGroup but notBaseExceptionGroup.


The BaseExceptionGroup constructor returns an ExceptionGrouprather than a BaseExceptionGroup if all contained exceptions areException instances, so it can be used to make the selectionautomatic. The ExceptionGroup constructor, on the other hand,raises a TypeError if any contained exception is not anException subclass.


The condition can be either a function that accepts an exception and returnstrue for those that should be in the subgroup, or it can be an exception typeor a tuple of exception types, which is used to check for a match using thesame check that is used in an except clause.


The condition is checked for all exceptions in the nested exception group,including the top-level and any nested exception groups. If the condition istrue for such an exception group, it is included in the result in full.


This method is used by subgroup() and split(), whichare used in various contexts to break up an exception group. Asubclass needs to override it in order to make subgroup()and split() return instances of the subclass ratherthan ExceptionGroup.


Also, exceptions like OverflowError, UnicodeEncodeError and UnicodeDecodeError are common when pass int, float, str or bytes argument. Static type checking controls types of arguments, but not their values.

3a8082e126
Reply all
Reply to author
Forward
0 new messages