View PlGroup Exceptions
ID | 14 |
---|---|
Text | Exceptions |
Title | Not set |
PlItems
- try // Code except // Handle the exception here... end;
- try: print 1/0 except Exception as e: print traceback.extract_stack() else: print "this is the else block" finally: print "finally clean up or something"
- if (a!=b): raise Exception("Not implemented, yet")
- -- See also: http://msdn.microsoft.com/de-de/library/ms175976(v=sql.105).aspx -- !! -- TRY-CATCH cannot be used for all operations/situations in T-SQL. -- Be careful and refer to the link above for details -- !! BEGIN TRY SELECT 1/0; END TRY BEGIN CATCH SELECT ERROR_NUMBER() AS ErrorNumber ,ERROR_SEVERITY() AS ErrorSeverity ,ERROR_STATE() AS ErrorState ,ERROR_PROCEDURE() AS ErrorProcedure ,ERROR_LINE() AS ErrorLine ,ERROR_MESSAGE() AS ErrorMessage; END CATCH;
- $DirectoryName = "C:\Temp\rename_test_new" Try { $newDirectoryName = $DirectoryName -replace "_new", "_old" Rename-Item -path $DirectoryName -newName $newDirectoryName } Catch { Write-host "Error. Exit!" Write-Error $_.Exception.Message exit # Wenn das Script hart beendet werden soll, dann kann exit verwendet werden }