Skip to content

Commit f9917d6

Browse files
committed
improved error messages
1 parent 113f46d commit f9917d6

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.1.2
4+
5+
- improved the error message when we're unable to bind to the requested port
6+
37
## 0.1.1
48

59
- added a logging option (`--log`)

bin/mserve.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,8 @@ void main(List<String> args) {
4242
.start(path: dir, port: port, log: results['log'])
4343
.then((MicroServer server) {
4444
print('Serving ${server.path} on ${server.urlBase}');
45+
}).catchError((e) {
46+
print('Unable to start server.\n (${e})');
47+
exit(1);
4548
});
4649
}

lib/mserve.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MicroServer {
3434
_server.listen((HttpRequest r) {
3535
if (shouldLog) {
3636
InternetAddress address = r.connectionInfo.remoteAddress;
37-
print('[${address.host}] ${r.method} ${r.requestedUri}');
37+
print('[from ${address.host}] ${r.method} ${r.requestedUri}');
3838
}
3939
vDir.serveRequest(r);
4040
}, onError: (e) => _errorController.add(e));

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mserve
22
description: A small (micro) web server.
3-
version: 0.1.1
3+
version: 0.1.2
44
author: Devon Carew <[email protected]>
55
homepage: https://github.com/devoncarew/mserve.dart
66

0 commit comments

Comments
 (0)