Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rtmigo/errno
Defines system error code constants for the OSs running the Dart platform
https://github.com/rtmigo/errno
android dart dart-library darwin errno error-codes error-success errors exceptions flutter header-files headers ios kernel linux macos os posix windows winerror
Last synced: 9 days ago
JSON representation
Defines system error code constants for the OSs running the Dart platform
- Host: GitHub
- URL: https://github.com/rtmigo/errno
- Owner: rtmigo
- License: mit
- Created: 2021-03-22T23:06:53.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-24T01:24:54.000Z (almost 4 years ago)
- Last Synced: 2024-12-18T22:37:16.176Z (about 1 month ago)
- Topics: android, dart, dart-library, darwin, errno, error-codes, error-success, errors, exceptions, flutter, header-files, headers, ios, kernel, linux, macos, os, posix, windows, winerror
- Language: Dart
- Homepage: https://pub.dev/packages/errno
- Size: 314 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Pub Package](https://img.shields.io/pub/v/errno.svg)](https://pub.dev/packages/errno)
[![Actions Status](https://github.com/rtmigo/errno/workflows/unittest/badge.svg?branch=master)](https://github.com/rtmigo/errno/actions)# [errno](https://github.com/rtmigo/errno)
Defines **system error code** constants for the OSs running the Dart platform.
With these numeric codes, the
[OSError.errorCode](https://api.dart.dev/stable/dart-io/OSError/errorCode.html)
property usually specifies the problem that occurred.| OS | Class |
|----------------|-----------------|
| Android, Linux | `LinuxErrors` |
| iOS, macOS | `DarwinErrors` |
| Windows | `WindowsErrors` |## Example
``` dart
import 'dart:io';import 'package:errno/errno.dart';
void main() {
try {
var lst = Directory("My Documents").listSync();
print(lst);} on FileSystemException catch (exc) {
if (exc.osError?.errorCode == WindowsErrors.pathNotFound) {
print("The directory does not exist.");} else {
rethrow;
}
}
}
```