public void Test3_InvalidSignatureFormat() { byte[] data = resources.ResourceTestV1.test3_invalid_signature_format; Error e = Biscuit.Token.Biscuit.FromBytes(data).Left; Console.WriteLine("got error: " + e); Assert.IsTrue(e is DeserializationError); DeserializationError errorDeserialized = (DeserializationError)e; Assert.IsTrue(errorDeserialized.e.Contains("Input must by 32 bytes")); }
private Task RunReceiveAsync(ClientWebSocket client, TaskCompletionSource <bool> readySignal, CancellationToken cancelToken) { return(Task.Run(async() => { while (true) { cancelToken.ThrowIfCancellationRequested(); try { await ReceiveAsync(client, readySignal, cancelToken).ConfigureAwait(false); } catch (SerializationException ex) { DeserializationError?.Invoke(ex); } } })); }
private Task RunReceiveAsync(ClientWebSocket client, TaskCompletionSource <bool> readySignal, CancellationToken cancelToken) { return(Task.Run(async() => { while (true) { cancelToken.ThrowIfCancellationRequested(); try { await ReceiveAsync(client, readySignal, cancelToken).ConfigureAwait(false); } catch (WumpusRpcException ex) when(ex.Code == 4005) // Unknown id { // Ignore for now - this should be sent through to the promise that cause the error } catch (SerializationException ex) { DeserializationError?.Invoke(ex); } } })); }
protected virtual void OnDeserializationError(object error) { DeserializationError?.Invoke(this, error); }