Skip to content

Commit

Permalink
Added env method to the helper file
Browse files Browse the repository at this point in the history
  • Loading branch information
javad-zobeidi committed Mar 31, 2024
1 parent 122115e commit d8e5b39
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/src/database/migration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MigrationConnection {
dbConnection = database!.connection;
} on InvalidArgumentException catch (e) {
print('Error establishing a database connection');
Logger.log(e.toString(), type: Logger.ERROR);
Logger.log(e.cause.toString(), type: Logger.ERROR);
} catch (e) {
Logger.log(e.toString(), type: Logger.ERROR);
print(e);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/database/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Model {
try {
return _connection().table(_table!);
} on InvalidArgumentException catch (e) {
Logger.log(e.toString(), type: Logger.ERROR);
Logger.log(e.cause.toString(), type: Logger.ERROR);
rethrow;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/server/base_http_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BaseHttpServer {
await db.driver?.init(Config().get('database'));
}
} on InvalidArgumentException catch (e) {
Logger.log(e.toString(), type: Logger.ERROR);
Logger.log(e.cause.toString(), type: Logger.ERROR);
rethrow;
}
}
Expand Down
4 changes: 4 additions & 0 deletions lib/src/utils/helper.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'dart:io';

import 'package:vania/vania.dart';

String storagePath(String file) => '${Directory.current.path}/storage/$file';

String publicPath(String file) => '${Directory.current.path}/public/$file';

T env<T>(String key, [dynamic defaultValue]) => Env.get<T>(key, defaultValue);

0 comments on commit d8e5b39

Please sign in to comment.