Skip to content

Commit

Permalink
ignore all io errors while resolving source files (#12)
Browse files Browse the repository at this point in the history
* ignore all io errors while resolving source files

* prep for release
  • Loading branch information
yaahc authored Dec 2, 2020
2 parents a1335a7 + 2eebd84 commit f7e61e6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- next-header -->

## [Unreleased] - ReleaseDate

## [0.1.6] - 2020-12-02
### Fixed
- Ignore all io errors when resolving source files instead of only file not
found errors

## [v0.1.5] - 2020-12-01
### Added
- Support custom color themes for spantrace format

<!-- next-url -->
[Unreleased]: https://github.com/yaahc/color-spantrace/releases/tag/v0.1.5
[Unreleased]: https://github.com/yaahc/color-spantrace/compare/v0.1.6...HEAD
[0.1.6]: https://github.com/yaahc/color-spantrace/compare/v0.1.5...v0.1.6
[v0.1.5]: https://github.com/yaahc/color-spantrace/releases/tag/v0.1.5
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "color-spantrace"
version = "0.1.6-alpha.0"
version = "0.1.6"
authors = ["Jane Lusby <[email protected]>"]
edition = "2018"
license = "MIT OR Apache-2.0"
Expand All @@ -26,6 +26,9 @@ ansi-parser = "0.6.5" # used for testing color schemes
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.release]
no-dev-version = true

[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
search = "Unreleased"
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
//!
//! [`tracing_error::SpanTrace`]: https://docs.rs/tracing-error/*/tracing_error/struct.SpanTrace.html
//! [`color-backtrace`]: https://github.com/athre0z/color-backtrace
#![doc(html_root_url = "https://docs.rs/color-spantrace/0.1.4")]
#![doc(html_root_url = "https://docs.rs/color-spantrace/0.1.6")]
#![warn(
missing_debug_implementations,
missing_docs,
Expand Down Expand Up @@ -88,7 +88,7 @@ use owo_colors::{style, Style};
use std::env;
use std::fmt;
use std::fs::File;
use std::io::{BufRead, BufReader, ErrorKind};
use std::io::{BufRead, BufReader};
use tracing_error::SpanTrace;

static THEME: OnceCell<Theme> = OnceCell::new();
Expand Down Expand Up @@ -315,8 +315,8 @@ impl Frame<'_> {

let file = match File::open(filename) {
Ok(file) => file,
Err(ref e) if e.kind() == ErrorKind::NotFound => return Ok(()),
e @ Err(_) => e.unwrap(),
// ignore io errors and just don't print the source
Err(_) => return Ok(()),
};

use std::fmt::Write;
Expand Down
1 change: 1 addition & 0 deletions tests/themes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use tracing_error::SpanTrace;
use tracing_subscriber::{prelude::*, registry::Registry};

#[instrument]
#[allow(clippy::clippy::if_same_then_else)]
fn test_capture(x: u8) -> SpanTrace {
if x == 42 {
SpanTrace::capture()
Expand Down

0 comments on commit f7e61e6

Please sign in to comment.