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

View File

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

View File

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