2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Improved debug messages

This commit is contained in:
Oliver Walters 2022-05-22 09:17:32 +10:00
parent 625d29fcf1
commit 4e14bd077c
3 changed files with 7 additions and 15 deletions

View File

@ -341,7 +341,7 @@ class InvenTreeAPI {
// Clear the list of available plugins
_plugins.clear();
print("Connecting to ${apiUrl} -> username=${username}");
debug("Connecting to ${apiUrl} -> username=${username}");
APIResponse response;
@ -434,7 +434,7 @@ class InvenTreeAPI {
// Return the received token
_token = (data["token"] ?? "") as String;
print("Received token - $_token");
debug("Received token from server");
// Request user role information (async)
getUserRoles();
@ -448,7 +448,7 @@ class InvenTreeAPI {
}
void disconnectFromServer() {
print("InvenTreeAPI().disconnectFromServer()");
debug("API : disconnectFromServer()");
_connected = false;
_connecting = false;
@ -504,7 +504,7 @@ class InvenTreeAPI {
roles.clear();
print("Requesting user role data");
debug("API: Requesting user role data");
// Next we request the permissions assigned to the current user
// Note: 2021-02-27 this "roles" feature for the API was just introduced.
@ -534,7 +534,7 @@ class InvenTreeAPI {
return;
}
print("Requesting plugin information");
debug("API: getPluginInformation()");
// Request a list of plugins from the server
final List<InvenTreeModel> results = await InvenTreePlugin().list();
@ -664,7 +664,7 @@ class InvenTreeAPI {
_request.headers.set(HttpHeaders.acceptLanguageHeader, Intl.getCurrentLocale());
} on SocketException catch (error) {
print("SocketException at ${url}: ${error.toString()}");
debug("SocketException at ${url}: ${error.toString()}");
showServerError(L10().connectionRefused, error.toString());
return;
} on TimeoutException {
@ -673,7 +673,7 @@ class InvenTreeAPI {
return;
} on HandshakeException catch (error) {
print("HandshakeException at ${url}:");
print(error.toString());
debug(error.toString());
showServerError(L10().serverCertificateError, error.toString());
return;
} catch (error, stackTrace) {
@ -1236,8 +1236,6 @@ class InvenTreeAPI {
var plugins = getPlugins(mixin: "locate");
print("locateItemOrLocation");
if (plugins.isEmpty) {
// TODO: Error message
return;

View File

@ -60,16 +60,11 @@ class InvenTreePreferencesDB {
// Get a platform-specific directory where persistent app data can be stored
final appDocumentDir = await getApplicationDocumentsDirectory();
print("Documents Dir: ${appDocumentDir.toString()}");
print("Path: ${appDocumentDir.path}");
// Path with the form: /platform-specific-directory/demo.db
final dbPath = join(appDocumentDir.path, "InvenTreeSettings.db");
final database = await databaseFactoryIo.openDatabase(dbPath);
// Any code awaiting the Completer's future will now start executing
_dbOpenCompleter.complete(database);
}
}

View File

@ -344,7 +344,6 @@ class _ProfileEditState extends State<ProfileEditWidget> {
Uri uri = Uri.parse(value);
if (uri.hasScheme) {
print("Scheme: ${uri.scheme}");
if (!["http", "https"].contains(uri.scheme.toLowerCase())) {
return L10().serverStart;
}