block / block/builderbot

Eliminate the .map_err(|e| e.to_string()) boilerplate

Open
#331 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
84
Forks
25
Avg merge
15h 53m
Merged PRs (30d)
22

Description

There are 97 instances of .map_err(|e| e.to_string()) and another 14 of .map_err(|e| format!(...)) in lib.rs alone. This is the classic Tauri command error-handling pattern that can be cleaned up by:

Defining an AppError enum that implements Into (or just impl From for String via a wrapper)
Or using a type alias like type CmdResult = Result with a blanket .map_err() trait extension
Tauri 2.x supports impl serde::Serialize for command errors — a custom error type with impl From or From would let you use ? directly
This would remove a huge amount of noise from every command handler.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.