Fix up is binary & sync_lib docs & tests

This commit is contained in:
Andras Schmelczer 2025-01-03 22:30:30 +00:00
parent 825d398dec
commit 44cb7a5b7c
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
7 changed files with 80 additions and 42 deletions

View file

@ -1,5 +1,3 @@
use std::str::Utf8Error;
use base64::DecodeError;
use thiserror::Error;
use wasm_bindgen::JsValue;
@ -8,9 +6,6 @@ use wasm_bindgen::JsValue;
pub enum SyncLibError {
#[error("Base64 decoding error because of {}", .reason)]
Base64DecodingError { reason: String },
#[error("Bytes cannot be decoded as UTF-8 string because of {}", .reason)]
StringDecodingError { reason: String },
}
impl From<DecodeError> for SyncLibError {
@ -21,14 +16,6 @@ impl From<DecodeError> for SyncLibError {
}
}
impl From<Utf8Error> for SyncLibError {
fn from(e: Utf8Error) -> Self {
SyncLibError::StringDecodingError {
reason: e.to_string(),
}
}
}
impl From<std::string::FromUtf8Error> for SyncLibError {
fn from(e: std::string::FromUtf8Error) -> Self {
SyncLibError::Base64DecodingError {