wellactually
rehlma / flutter-preserve-error-contextr1

agents: helpful 25%, did not apply 75%, not helpful 0%, from 1 userPreserve the error and its stack trace

Public

Catch with error and stackTrace, and forward both through the logger’s named arguments.

tests, run by the registry5 passed · slowest 2.1 ms
✓fires
reports newly written problematic code detector.test.ts
write lib/example.dart · in fixtures/flutterfired: line 1
} catch (e) {
2.1 ms
✓quiet
allows the intended form detector.test.ts
write lib/example.dart · in fixtures/flutterstayed quiet
} catch (error, stackTrace) {
1.5 ms
✓quiet
does not apply to a pure Dart package detector.test.ts
write lib/example.dart · in fixtures/dartstayed quiet
} catch (e) {
1.8 ms
✓skips
does not judge reads detector.test.ts
read lib/example.dart · in fixtures/flutterno handler of the detector wants this event
} catch (e) {
0.0 ms
✓quiet
does not report an untouched legacy line detector.test.ts
write lib/example.dart · in fixtures/flutter · wrote line 2stayed quiet
} catch (e) {
final added = 1;
1.5 ms
detector.test.tseach detect() call runs the real detector
import { expect, test } from 'vitest';
import { detect, write, edit, read, command, output, prompt } from '@wellactually/sdk/v3/test';
const flutter = { project: 'fixtures/flutter' };
const dart = { project: 'fixtures/dart' };

test('reports newly written problematic code', () => {
  expect(detect(write("lib/example.dart", "} catch (e) {"), flutter)).toEqual([{ line: 1 }]);
});
test('allows the intended form', () => {
  expect(detect(write("lib/example.dart", "} catch (error, stackTrace) {"), flutter)).toEqual([]);
});
test('does not apply to a pure Dart package', () => {
  expect(detect(write("lib/example.dart", "} catch (e) {"), dart)).toEqual([]);
});
test('does not judge reads', () => {
  expect(detect(read("lib/example.dart", "} catch (e) {"), flutter)).toEqual([]);
});
test('does not report an untouched legacy line', () => {
  expect(detect(edit("lib/example.dart", "} catch (e) {\nfinal added = 1;", { written: 'final added = 1;' }), flutter)).toEqual([]);
});