585 Commits

Author SHA1 Message Date
Jane Lusby
60218fff20
Add track_caller on APIs missing it (#48)
This change adds `track_caller` annotations to `context.rs` on various trait helper methods (`wrap_err`) that were missing it. It also adds tests for these APIs to ensure that the location captured is in the file that created the error.
2021-01-04 18:08:27 +00:00
d4h0
097ae873d6
Support for custom styles (#69)
* Add color scheme backwards compatibility test

* Rewrote test case for color schemes

* implementation

* Add missing test data

* Update src/config.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* Update src/config.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* Update src/config.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* Implement suggestions

* bump versions and update control copy of test output

* move THEME setting into core method

* update theme install and propagation to avoid a once-cell

* disable spantrace theme-ing with feature

* fix panic theme test to include a spantrace in the panic itself

* fix inconsistent theme propagation

* disable panic test for different feature configs

* cleanup logs

* try copying control from raw github test logs

* add rust-src for test consistency

* update test outputs

* just dont bother testing source resolution

* format unknown files consistently with known ones

* test format for multiple feature combinations

* store data for alternate theme configurations

* fix dependency coloration when missing hash suffix

* update changelog

* depend on as of yet unreleased owo-colors version

* (cargo-release) version 0.5.10

Co-authored-by: d4h0 <d4h0@obyz.de>
Co-authored-by: Jane Lusby <jlusby@yaah.dev>
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-12-04 10:39:02 -08:00
Jane Lusby
716621f84d
bump spantrace version to fix a panic (#76)
* bump spantrace version to fix a panic

* (cargo-release) version 0.5.9
2020-12-02 11:19:54 -08:00
Jane Lusby
f7e61e648f
ignore all io errors while resolving source files (#12)
* ignore all io errors while resolving source files

* prep for release
2020-12-02 11:12:34 -08:00
Jane Lusby
2eebd84950 (cargo-release) version 0.1.6 2020-12-02 11:07:20 -08:00
Jane Lusby
804992769c prep for release 2020-12-02 11:05:06 -08:00
Jane Lusby
edfcda0d44 ignore all io errors while resolving source files 2020-12-02 10:56:46 -08:00
d4h0
a1335a718c
Support for custom styles and owo_colors (#11)
* init

* Add missing test data

* Implement requested changes

* Rename test/styles.rs and tests/data/style_control.txt

* bump version on owo-colors and run rustfmt

* update control to include source lines

* tweek the documentation a little

* bump version and prep for release

* (cargo-release) start next development iteration 0.1.6-alpha.0

Co-authored-by: d4h0 <d4h0@obyz.de>
Co-authored-by: Jane Lusby <jlusby@yaah.dev>
2020-12-01 17:58:10 -08:00
Dominik Boehi
6063ec81c5
Fix broken link in README (#75)
The link to the `Section` trait wasn't working.
2020-11-27 11:53:58 -08:00
Luke Frisken
60e426e43e
#66 work in progress make print_panic_info() public (#67)
* add example of desired usage

* reimplement all of kellpossibles pr

* reorganizing to minimize diff

* update changelog for release

* (cargo-release) version 0.5.8

* (cargo-release) start next development iteration 0.5.9-alpha.0

Co-authored-by: Jane Lusby <jlusby@yaah.dev>
2020-11-23 16:33:06 -08:00
Jane Lusby
8e5d24a73f
New minor version release for track caller fixes (#43)
* Update changelog

* (cargo-release) version 0.6.3

* (cargo-release) start next development iteration 0.6.4-alpha.0
2020-11-11 15:48:38 -08:00
Ivan Smirnov
914da85eb5
Add #[track_caller] for adhoc errors (#42) 2020-11-10 10:48:40 -08:00
Jane Lusby
198600fa05
new minor version release (#71)
* update changelog for new release

* update gitignore so cargo release likes me again

* (cargo-release) version 0.5.7

* (cargo-release) start next development iteration 0.5.8-alpha.0

* try using matrix for feature combinations
2020-11-05 16:37:49 -08:00
Paul Horn
030dc5a547
Add feature more gates for capture-spantrace (#70)
* Add feature more gates for capture-spantrace

When only the `issue-url` features is enabled, with the default
features being disabled, the crate fails to build

```
$ cargo build --no-default-features --features issue-url
   Compiling color-eyre v0.5.7-alpha.0 (/Users/paul/dev/color-eyre)
error[E0432]: unresolved import `tracing_error`
 --> src/section/github.rs:5:5
  |
5 | use tracing_error::SpanTrace;
  |     ^^^^^^^^^^^^^ use of undeclared type or module `tracing_error`

error[E0282]: type annotations needed
  --> src/section/github.rs:28:25
   |
28 |             span_trace: None,
   |                         ^^^^ cannot infer type for type parameter `T` declared on the enum `Option`

error: aborting due to 2 previous errors
```

This commit add feature gates for capture-spantrace to the github
issue module, so that the issue-url feature can be used standalone.

* ignore broken doctest and add new ci configs

* make the ci configs differentiable

Co-authored-by: Jane Lusby <jlusby@yaah.dev>
2020-11-05 16:24:05 -08:00
Jane Lusby
0722bab8ea
fix missing track caller annotation (#40)
* fix missing track caller annotation

* (cargo-release) version 0.6.2

* (cargo-release) start next development iteration 0.6.3-alpha.0
2020-10-27 12:46:16 -07:00
Kevin Menard
44a6857093
Fix typos. (#39) 2020-10-08 12:41:28 -07:00
Jane Lusby
dd2103291a
Add support for track caller via new feature flag (#68)
* Add support for track caller via new feature flag

* edit changelog

* add missing cfgs

* (cargo-release) version 0.5.6

* (cargo-release) start next development iteration 0.5.7-alpha.0
2020-10-02 18:16:12 -07:00
Jane Lusby
032d879381
Implement track caller support for eyre::Report (#36)
* Implement track caller support for eyre::Report

* fix errors on old compiler version

* fix tests

* add a changelog

* (cargo-release) version 0.6.1-rc.1

* Allow missing replacement for diff range

* maybe it has to be deleted

* okay try removing it entirely...

* (cargo-release) version 0.6.1

* (cargo-release) start next development iteration 0.6.2-alpha.0

* add back missing replacement
2020-09-28 19:38:53 -07:00
Jane Lusby
4ddaeb2126
add support for filtering issue generation for errors (#64)
* add support for filtering issue generation for errors

* cleanup for release candidate

* fix error in doc test

* fix other errors in doctest

* now the doc test actually passes

* (cargo-release) version 0.5.5-rc.1

* (cargo-release) version 0.5.5

* (cargo-release) start next development iteration 0.5.6-alpha.0
2020-09-21 16:02:02 -07:00
Jane Lusby
9c738c3a39
Implement github issue generator (#62)
* Initial implementation of github issue generator

* document the hookbuilder methods

* fix doctest

* make issue generation feature optional

* update changelog

* (cargo-release) version 0.5.4-rc.1

* add doc cfg attr to new methods

* (cargo-release) version 0.5.4-rc.2

* supress issue sections when they'd be empty

* (cargo-release) version 0.5.4-rc.3

* (cargo-release) version 0.5.4

* (cargo-release) start next development iteration 0.5.5-alpha.0
2020-09-17 14:14:38 -07:00
Alex Chan
05809302b3
Fix a typo: indenteted ~> indented (#63) 2020-09-16 13:30:02 -07:00
Jane Lusby
d1ff3e8bd5
bump version for next release (#61)
* (cargo-release) version 0.5.3

* (cargo-release) start next development iteration 0.5.4-alpha.0

* add alpha.0 to html_root_url

* change of plan
2020-09-14 19:52:18 -07:00
Jane Lusby
74fa2c9dea
oops that didn't quite work (#60) 2020-09-14 19:15:07 -07:00
Jane Lusby
5365400b3e
prep for release (#59)
* (cargo-release) start next development iteration 0.5.3-alpha.0

* bump version in lib.rs too

* add more configuration to help with release process

* fix replace section for html_root_url
2020-09-14 19:09:15 -07:00
Jane Lusby
ff84554ed4
Add support for customized panic message sections (#57)
* (cargo-release) start next development iteration 0.5.3-alpha.0

* add support for customized panic messages

* reorg a little

* add example and changelog

* reorder items in example

* fix missing semi
2020-09-14 18:54:35 -07:00
Jane Lusby
17c325d38f
(cargo-release) start next development iteration 0.5.3-alpha.0 (#56)
* (cargo-release) start next development iteration 0.5.3-alpha.0

* bump version in lib.rs too
2020-09-01 10:16:56 -07:00
Jane Lusby
e3db0438ae
bump version for new release (#55) 2020-08-31 23:10:40 -07:00
Jane Lusby
ecb0642f77
Fix Section trait to work with Result and Report (#54) 2020-08-31 22:49:54 -07:00
Jane Lusby
1005cfcf36
owo merge this (#53)
* owo

* kindaaa fixed it
2020-08-27 12:22:09 -07:00
Za Wilcox
8c4cb4f66e
fixed minor errors in README, ?enhanced? punny-ness (#33)
Co-authored-by: zancas <zancas@zingolabs.com>
2020-08-24 14:31:49 -07:00
Stu
62434e40aa
Replace Help trait with Section in README (#52) 2020-08-24 13:50:23 -07:00
Stu
5cf35afaa8
Add panic_note to HookBuilder (#51)
* Implement panic_note feature

* Fix typo

* Rename to panic_section and use Display impl

* Update src/config.rs

* Move panic_section after panic message

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-08-24 13:09:33 -07:00
Jane Lusby
a83c478a70
Add config option to disable env section (#49)
* Add config option to disable env section

* fix tests
2020-08-22 15:31:24 -07:00
Jane Lusby
f96519e594
Add __rust_begin_short_backtrace filter (#48)
This frame was added for the exact purpose of allowing proper filtering:

https://github.com/rust-lang/rust/issues/47429
2020-08-17 14:19:56 -07:00
Jane Lusby
7316c8ff94
make new release (#46)
* change panic example to be consistent with usage example

* bump versions for new release
2020-08-06 12:44:50 -07:00
Rebecca Turner
544ef9feba
Use <span> instead of <font> in documentation (#44)
* Use `<span>` instead of `<font>` in documentation

The `<font>` tag was deprecated in [HTML 4.01]. Let's use the verbose
but standardized `<span>` tag with discouraged but supported inline
styles instead.

(I was wrong when I said it was deprecated before I was born; though
[HTML 4]'s spec was published in 1997, about 6 months before I was born,
`<font>` was only deprecated in HTML 4.01, published 2 years later when
I was about 16 months old.)

[HTML 4]: https://www.w3.org/TR/REC-html40-971218/
[HTML 4.01]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/font

* Add script to convert `<span>` to `<font>` in docs

```
$ ./scripts/fix_html_examples.py --help
usage: fix_html_examples.py [-h] file [file ...]

Convert HTML from Gnome terminal's 'Copy as HTML' feature to use modern
<span> tags and inline CSS. This script is idempotent, i.e. multiple
invocations will not change the output past the first invocation.

positional arguments:
  file        Rust file to update <pre> blocks in.

optional arguments:
  -h, --help  show this help message and exit

$ ./scripts/fix_html_examples.py src/*.rs
Nothing to fix in src/config.rs
Nothing to fix in src/handler.rs
Updated example colored output in src/lib.rs
Nothing to fix in src/private.rs
Nothing to fix in src/writers.rs

$ ./scripts/fix_html_examples.py src/*.rs
Nothing to fix in src/config.rs
Nothing to fix in src/handler.rs
Nothing to fix in src/lib.rs
Nothing to fix in src/private.rs
Nothing to fix in src/writers.rs
```

Co-authored-by: Rebecca Turner <rturner@linkedin.com>
2020-07-30 11:23:18 -07:00
Jane Lusby
74c46d6090
fix output format to be more consistent (#43)
* fix output format to be more consistent

* cleanup header writer interface
2020-07-26 14:16:59 -07:00
Jane Lusby
318241a118
print panics via eprinln to leverage test io capture (#42)
* print panics via eprinln to leverage test io capture

* move things into a display impl to only acquire the lock once

* unfuck indentation

* use original identifier for output stream
2020-07-26 11:32:51 -07:00
Cynthia Coan
1df9ec5f44
add testing for wasm (#38)
* add testing for wasm

utilize wasm-bindgen-test as a developer dependency in order to
actively run wasm tests. wasm currently doesn't have support for
running doctests (and reportedly won't "anytime soon"), and in
order to actually run the tests we need a wasm environment.

the easiest of these to setup & use is wasm-pack which is primarly
built for nodejs. however, if it works in nodejs it should ideally
work in other wasm environments that are similar.

as such a wasm-pack (which utilizies wasm-bindgen) as a developer
dependency has been added that creates a simple error message,
and validates it contains the text of the error (and sections)
sans any formatting. this is meant to validate a base level
of functionality as time goes on.

* fix format

* only add dev-dependency for wasm32

* fix clippy warning

Co-authored-by: Jane Lusby <jlusby@yaah.dev>
2020-07-23 16:23:08 -07:00
Jane Lusby
9e6a349c8e
port color-eyre to new eyre with global hook (#29)
* port color-eyre to new eyre with global hook

* add a singular hook configuration

* add panic handler to globally installed hook

* getting near the end

* remove unused module

* temp: working on capture consistency

* walk back changes that make porting to new release harder

* merge main into hooked

* switch to github color-spantrace and copy from htmlgit status

* move spantrace capture default mode into hook

* rename and reorg section stuff

* switch to released deps

* copy changes from lib.rs to readme

* update snippets and revert to images for readme

* remove extremely fragile format tests
2020-07-05 19:22:57 -07:00
Jane Lusby
0769344643
bump version for new release (#8) 2020-07-05 19:05:18 -07:00
Jane Lusby
f39eaff0b2
Switch report handler to a global hook (#29)
* Switch report handler to a global hook

* more cleanup

* remove default from example

* remove broken support for no_std

* back out the unneeded nostd check

* remove one stackframe when capturing a Handler

* update docs and prep for release

* port lib.rs docs updates to readme
2020-07-05 19:04:31 -07:00
Jane Lusby
fe08025c69
add support for conditional capture of span traces (#33)
* add support for conditional capture of span traces

* document how to disable spantraces
2020-07-05 15:28:02 -07:00
Jane Lusby
1f1aeb7773
colorize line numbers and fix indentation issue (#7) 2020-06-25 15:32:12 -07:00
Jane Lusby
69db885ecc
fix issue with spantrace capture in last release (#28) 2020-06-21 13:22:38 -07:00
Jane Lusby
63b8bc71e0
depend on next version of eyre (#27)
* depend on next version of eyre

* more use statement updates

* fix line numbers for windows test
2020-06-21 11:10:21 -07:00
Jane Lusby
96ddb39cd0
fix type inference issue in eyre macro autoderef behavior (#27)
* fix type inference issue in eyre macro autoderef behavior

* use the upstream example

* update testcase compile err output

* remove cruft

* bump version for breaking change
2020-06-21 10:41:56 -07:00
Saquib
b5060a5c16
Fix cleanup warnings in tests/minimal.rs when compiled for windows. (#25) 2020-06-04 11:27:51 -07:00
Jane Lusby
fff76b1424
dedupe ansi-term dependency (#24) 2020-06-02 18:50:18 -07:00
Jane Lusby
84615473ed
Dedupdep (#3)
* dedupe ansi_term dep

* bump version for release
2020-06-02 18:45:04 -07:00