--- title: "Handling Exceptions" slug: "handling-exceptions" updated: 2024-11-18T12:49:39Z published: 2024-11-18T12:49:39Z canonical: "docs.onespan.com/handling-exceptions" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # Gestion des exceptions [Java SDK](/v1/docs/fr/handling-exceptions#java-sdk) [.NET SDK](/v1/docs/fr/handling-exceptions#kit-de-développement-logiciel-sdk-net) ## Java SDK Pour télécharger l’exemple de code complet, consultez notre site [Code Share](https://github.com/eSignLive/esl.sdk.java/blob/master/sdk/src/main/java/com/silanis/esl/sdk/examples/ExceptionHandlingExample.java) . Les types d’exception suivants existent dans OneSpan Sign : - EslException : il s’agit d’une exception générale. Il comprend une chaîne de caractères qui indique ce qui a échoué. - EslServerException : il s’agit d’une sous-classe de EslException. Une exception EslServerException est levée lorsque le serveur renvoie du code inattendu à partir d’une demande. L’EslServerException contient également la réponse exacte du serveur à partir de la demande d’API sous-jacente. L’exemple de code suivant illustre comment différencier ces types d’exceptions et comment accéder à la réponse du serveur sous-jacent si une EslServerException est levée : ```java try {      signer = signerBuilder.build(); } catch( EslException eslException ) {      System.out.println( eslException.getLocalizedMessage() );      return; } try {     eslClient.getPackageService().addSigner( new PackageId( "myPackageId" ), signer); } catch( EslServerException eslServerException ) {      // The request was refused by the server for some reason...      System.out.println(eslServerException.getLocalizedMessage());      System.out.println(eslServerException.getServerError().getCode());      System.out.println(eslServerException.getServerError().getMessage());      System.out.println(eslServerException.getServerError().getTechnical());      return; } catch( EslException eslException ) {      System.out.println( eslException.getLocalizedMessage() );      return; } ``` ## Kit de développement logiciel (SDK) .NET Pour télécharger l’exemple de code complet, consultez notre site [Code Share](https://github.com/eSignLive/esl.sdk.net/blob/master/sdk/SDK.Examples/src/ExceptionHandlingExample.cs) . Les types d’exception suivants existent dans OneSpan Sign : - EslException : il s’agit d’une exception générale. Il comprend une chaîne de caractères qui indique ce qui a échoué. - EslServerException : il s’agit d’une sous-classe de EslException. Une exception EslServerException est levée lorsque le serveur renvoie du code inattendu à partir d’une demande. L’EslServerException contient également la réponse exacte du serveur à partir de la demande d’API sous-jacente. L’exemple de code suivant illustre comment différencier ces types d’exceptions et comment accéder à la réponse du serveur sous-jacent si une EslServerException est levée : ```csharp try {    signer = signerBuilder.Build(); } catch (EslException eslException) {     Console.Out.WriteLine(eslException.Message);     return; } try {     eslClient.PackageService.AddSigner(new PackageId("myPackageId"),signer);                                 } catch (EslServerException eslServerException) {      Console.Out.WriteLine(eslServerException.Message);      Console.Out.WriteLine(eslServerException.ServerError.Code);      Console.Out.WriteLine(eslServerException.ServerError.Message);      Console.Out.WriteLine(eslServerException.ServerError.Technical); } catch (EslException eslException) {      Console.Out.WriteLine(eslException.Message);      return; } ```