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

Remove and fix some TODO entries (#188)

This commit is contained in:
Oliver 2022-07-20 14:18:07 +10:00 committed by GitHub
parent 42d69365b8
commit 19ad3153e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 28 deletions

View File

@ -691,16 +691,16 @@ class InvenTreeAPI {
showServerError(url, L10().connectionRefused, error.toString()); showServerError(url, L10().connectionRefused, error.toString());
return; return;
} on TimeoutException { } on TimeoutException {
print("TimeoutException at ${url}"); debug("TimeoutException at ${url}");
showTimeoutError(url); showTimeoutError(url);
return; return;
} on HandshakeException catch (error) { } on HandshakeException catch (error) {
print("HandshakeException at ${url}:"); debug("HandshakeException at ${url}:");
debug(error.toString()); debug(error.toString());
showServerError(url, L10().serverCertificateError, error.toString()); showServerError(url, L10().serverCertificateError, error.toString());
return; return;
} catch (error, stackTrace) { } catch (error, stackTrace) {
print("Server error at ${url}: ${error.toString()}"); debug("Server error at ${url}: ${error.toString()}");
showServerError(url, L10().serverError, error.toString()); showServerError(url, L10().serverError, error.toString());
sentryReportError( sentryReportError(
"api.downloadFile : client.openUrl", "api.downloadFile : client.openUrl",
@ -730,8 +730,8 @@ class InvenTreeAPI {
} on TimeoutException { } on TimeoutException {
showTimeoutError(url); showTimeoutError(url);
} catch (error, stackTrace) { } catch (error, stackTrace) {
print("Error downloading image:"); debug("Error downloading image:");
print(error.toString()); debug(error.toString());
showServerError(url, L10().downloadError, error.toString()); showServerError(url, L10().downloadError, error.toString());
sentryReportError( sentryReportError(
"api.downloadFile : client.closeRequest", "api.downloadFile : client.closeRequest",
@ -956,25 +956,25 @@ class InvenTreeAPI {
return _request; return _request;
} on SocketException catch (error) { } on SocketException catch (error) {
print("SocketException at ${url}: ${error.toString()}"); debug("SocketException at ${url}: ${error.toString()}");
showServerError(url, L10().connectionRefused, error.toString()); showServerError(url, L10().connectionRefused, error.toString());
return null; return null;
} on TimeoutException { } on TimeoutException {
print("TimeoutException at ${url}"); debug("TimeoutException at ${url}");
showTimeoutError(url); showTimeoutError(url);
return null; return null;
} on CertificateException catch (error) { } on CertificateException catch (error) {
print("CertificateException at ${url}:"); debug("CertificateException at ${url}:");
print(error.toString()); debug(error.toString());
showServerError(url, L10().serverCertificateError, error.toString()); showServerError(url, L10().serverCertificateError, error.toString());
return null; return null;
} on HandshakeException catch (error) { } on HandshakeException catch (error) {
print("HandshakeException at ${url}:"); debug("HandshakeException at ${url}:");
print(error.toString()); debug(error.toString());
showServerError(url, L10().serverCertificateError, error.toString()); showServerError(url, L10().serverCertificateError, error.toString());
return null; return null;
} catch (error, stackTrace) { } catch (error, stackTrace) {
print("Server error at ${url}: ${error.toString()}"); debug("Server error at ${url}: ${error.toString()}");
showServerError(url, L10().serverError, error.toString()); showServerError(url, L10().serverError, error.toString());
sentryReportError( sentryReportError(
"api.apiRequest : openUrl", "api.apiRequest : openUrl",
@ -1054,8 +1054,8 @@ class InvenTreeAPI {
response.error = "SocketException"; response.error = "SocketException";
response.errorDetail = error.toString(); response.errorDetail = error.toString();
} on CertificateException catch (error) { } on CertificateException catch (error) {
print("CertificateException at ${request.uri.toString()}:"); debug("CertificateException at ${request.uri.toString()}:");
print(error.toString()); debug(error.toString());
showServerError(url, L10().serverCertificateError, error.toString()); showServerError(url, L10().serverCertificateError, error.toString());
} on TimeoutException { } on TimeoutException {
showTimeoutError(url); showTimeoutError(url);

View File

@ -44,8 +44,9 @@ void debug(dynamic msg) {
if (Platform.environment.containsKey("FLUTTER_TEST")) { if (Platform.environment.containsKey("FLUTTER_TEST")) {
debug_messages.add(msg.toString()); debug_messages.add(msg.toString());
print("DEBUG: ${msg.toString()}");
} }
print("DEBUG: ${msg.toString()}");
} }

View File

@ -514,12 +514,6 @@ class InvenTreeModel {
return results; return results;
} }
// Provide a listing of objects at the endpoint
// TODO - Static function which returns a list of objects (of this class)
// TODO - Define a "save" / "update" function
// Override this function for each sub-class // Override this function for each sub-class
bool matchAgainstString(String filter) { bool matchAgainstString(String filter) {
// Default implementation matches name and description // Default implementation matches name and description

View File

@ -57,8 +57,6 @@ class InvenTreePartCategory extends InvenTreeModel {
InvenTreeModel createFromJson(Map<String, dynamic> json) { InvenTreeModel createFromJson(Map<String, dynamic> json) {
var cat = InvenTreePartCategory.fromJson(json); var cat = InvenTreePartCategory.fromJson(json);
// TODO ?
return cat; return cat;
} }
} }

View File

@ -705,8 +705,6 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
context, context,
MaterialPageRoute(builder: (context) => StockNotesWidget(item)) MaterialPageRoute(builder: (context) => StockNotesWidget(item))
); );
// TODO: Load notes in markdown viewer widget
// TODO: Make this widget editable?
} }
) )
); );

View File

@ -79,8 +79,7 @@ void main() {
bool result = await api.connectToServer(); bool result = await api.connectToServer();
assert(!result); assert(!result);
// TODO: Test the the right 'error message' is returned debugContains("SocketException at");
// TODO: The request above should throw a 'SockeException'
// Test incorrect login details // Test incorrect login details
profile.server = "http://localhost:12345"; profile.server = "http://localhost:12345";
@ -91,7 +90,7 @@ void main() {
await api.connectToServer(); await api.connectToServer();
assert(!result); assert(!result);
// TODO: Test that the connection attempt above throws an authentication error debugContains("Token request failed");
assert(!api.checkConnection()); assert(!api.checkConnection());