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

Open
#331 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust, tauri
Domain
backend

Research direction

Start in lib.rs by reviewing the 97 .map_err(|e| e.to_string()) instances, the 14 formatted variants, and the surrounding Tauri command handlers. Compare the proposed AppError, wrapper, and CmdResult approaches, then define completion as removing the repeated error-mapping boilerplate while preserving command error reporting.

Written by the indexing model from the issue text.

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<T, String> with a blanket .map_err() trait extension
Tauri 2.x supports impl serde::Serialize for command errors — a custom error type with impl Fromanyhow::Error or Fromstore::Error would let you use ? directly
This would remove a huge amount of noise from every command handler.

Dominant language
Rust
Stars
85
Forks
25
Avg merge
18h 20m
Merged PRs (30d)
19

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from block/builderbot

All issues in block/builderbot

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.