the example in this section shows quick method for creating your own exceptions to perform this taskyou must create class that uses an existing exception as starting point to make things little easierthis example creates an exception that builds upon the functionality provided by the valueerror exception the advantage of using this approach rather than the one shown in the "passing error information to the callersectionthe preceding section in this is that this approach tells anyone who follows you precisely what the addition to the valueerror exception isadditionallyit makes the modified exception easier to use this example also appears with the downloadable source code as customexception py open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each lineclass customvalueerror(valueerror)def __init__(selfarg)self strerror arg self args {argtryraise customvalueerror("value must be within and "except customvalueerror as eprint("customvalueerror exception!" strerrorthis example essentially replicates the functionality of the example in the "passing error information to the callersection of the howeverit places the same error in both strerror and args so that the developer has access to either (as would normally happenthe code begins by creating the customvalueerror class that uses the valueerror exception class as starting point the __init__(function provides the means for creating new instance of that class think of the class as blueprint and the instance as the building created from the blueprint notice that the strerror attribute has the value assigned directly to itbut args receives it as an array the args member normally contains an array of all the exception valuesso this is standard procedureeven when args contains just one value as it does now the code for using the exception is considerably easier than modifying valueerror directly all you do is call raise with the name of the exception and the arguments you want to passall on one line