Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #491 - Enhancement : A more descriptive error messages #517

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Issue #491 - modify tangle and user controllers and front end error m…
…essages
sak93 committed May 15, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 478c4d88b78b4776e10138e7f592df6fb3ffab6f
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public void sendClaimForm(View view) {
mssgBody = ((EditText) findViewById(R.id.mssgText)).getText()
.toString();
if (mssgBody.equals("")) {
Toast.makeText(this, "Msssg body missing", Toast.LENGTH_LONG)
Toast.makeText(this, "Message body missing", Toast.LENGTH_LONG)
.show();
} else {

@@ -102,7 +102,7 @@ protected void onPostExecute(String response) {
intent.addFlags(intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else {
Toast.makeText(getBaseContext(), "Something went wrong",
Toast.makeText(getBaseContext(), this.getErrorMessage(),
Toast.LENGTH_SHORT).show();
}

Original file line number Diff line number Diff line change
@@ -189,7 +189,7 @@ protected void onPostExecute(String response) {
} else {

Toast.makeText(getApplicationContext(),
"Error, Can not create offer",
this.getErrorMessage(),
Toast.LENGTH_SHORT).show();
}
}
Original file line number Diff line number Diff line change
@@ -201,7 +201,7 @@ protected void onPostExecute(String response) {
finish();
} else {
Toast.makeText(getApplicationContext(),
"Error, Can not create request",
this.getErrorMessage(),
Toast.LENGTH_SHORT).show();
}
}
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ protected void onPostExecute(String response) {
} else {
if (!(this.getStatusCode() == 201)) {
Toast.makeText(getApplicationContext(),
"Try Again Later"+this.getStatusCode(), Toast.LENGTH_LONG).show();
this.getErrorMessage(), Toast.LENGTH_LONG).show();
} else {
goToHomePage();
}
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ else if(getResourceType().equals(Config.OFFER_TYPE)){

DeleteRequest deleteRequest = new DeleteRequest(url){
protected void onPostExecute(String res) {
String message = "Sorry, there are problems in the delete process. Please, try again later";
String message = this.getErrorMessage();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Success there are no error messages , this line will throw a null pointer exception if the status code was 200.


if (!this.hasError() && res != null) {
message = "Deleted!";
Original file line number Diff line number Diff line change
@@ -177,10 +177,10 @@ public void onPostExecute(String response) {

if (!this.hasError() && this.getStatusCode() == 200) {
if (!showData(response)) {
toasterShow("Something went wrong, please try again later");
toasterShow(this.getErrorMessage());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Success there are no error messages , this line will throw a null pointer exception if the status code was 200 and showData failed.

}
} else {
toasterShow("Something went wrong, please try again later");
toasterShow(this.getErrorMessage());
}
}
};
Original file line number Diff line number Diff line change
@@ -432,7 +432,7 @@ protected void onPostExecute(String response) {
}
} else {
Toast toast = Toast.makeText(getApplicationContext(),
getString(R.string.toastError),
this.getErrorMessage(),
Toast.LENGTH_SHORT);
toast.show();
}
@@ -467,6 +467,8 @@ public void onClick(View v) {
+ ACCEPT) {
protected void onPostExecute(String response) {
status = this.getStatusCode();
String responseMessage = this.getErrorMessage();

String errorMessage = this.getErrorMessage();
if (status == 201) {
acceptOffer.setVisibility(View.INVISIBLE);
@@ -479,13 +481,13 @@ protected void onPostExecute(String response) {
if (status == 405) {
Toast toast = Toast
.makeText(
getApplicationContext(),errorMessage,
getApplicationContext(),this.getErrorMessage(),
Toast.LENGTH_SHORT);
toast.show();
} else {
Toast toast = Toast.makeText(
getApplicationContext(),
getString(R.string.toastError),
this.getErrorMessage(),
Toast.LENGTH_SHORT);
toast.show();
}
@@ -555,14 +557,14 @@ public void markAsDone(int Offerid) {
protected void onPostExecute(String response) {
if (this.getStatusCode() == 201) {
Toast success = Toast.makeText(getApplicationContext(),
R.string.mark, Toast.LENGTH_LONG);
this.getErrorMessage(), Toast.LENGTH_LONG);
success.show();
markOfferAsDone.setEnabled(false);
markOfferAsDone.setVisibility(View.INVISIBLE);
offerStatus.setText("Done");
} else {
Toast error = Toast.makeText(getApplicationContext(),
R.string.error, Toast.LENGTH_LONG);
this.getErrorMessage(), Toast.LENGTH_LONG);
error.show();
}
}
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ protected void onPostExecute(String response) {
}
} else {
Log.e("test", this.getErrorMessage());
Toast toast = Toast.makeText(activity.getApplicationContext(),"Some error happened.",Toast.LENGTH_SHORT);
Toast toast = Toast.makeText(activity.getApplicationContext(),this.getErrorMessage(),Toast.LENGTH_SHORT);
toast.show();
}
}
Original file line number Diff line number Diff line change
@@ -94,13 +94,13 @@ protected void onPostExecute(String response) {
goToLogin(response);
} else if(this.getStatusCode() == 401){
Toast.makeText(getApplicationContext(),
"Not unique username",
this.getErrorMessage(),
Toast.LENGTH_SHORT).show();
}

else if(this.getStatusCode() == 402){
Toast.makeText(getApplicationContext(),
"Not unique email",
this.getErrorMessage(),
Toast.LENGTH_SHORT).show();
}

Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ protected void onPostExecute(String response) {
Toast.makeText(getBaseContext(), "Loading Claim Form", Toast.LENGTH_SHORT).show();
startActivity(intent);
} else {
Toast.makeText(getBaseContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
Toast.makeText(getBaseContext(), this.getErrorMessage(), Toast.LENGTH_SHORT).show();
}

} catch (JSONException e) {
Original file line number Diff line number Diff line change
@@ -283,7 +283,7 @@ public function inviteAction(Request $request, $tangleId) {
if (!$this->validateTangleId($tangleId)) {
return new Response("Tangle Not Found", 404);
}
d

$userTangleRepo = $this->getDoctrine()->getRepository('MegasoftEntangleBundle:UserTangle');

if (($userTangle = $userTangleRepo->findOneBy(array('userId' => $session->getUserId(), 'tangleId' => $tangleId))) == null) {
Original file line number Diff line number Diff line change
@@ -335,7 +335,7 @@ public function logoutAction(\Symfony\Component\HttpFoundation\Request $request)
$sessionRepo = $this->getDoctrine()->getRepository('MegasoftEntangleBundle:Session');
$session = $sessionRepo->findOneBy(array('sessionId' => $sessionId));
if (!$session) {
return new JsonResponse("Please login again" 404);
return new JsonResponse("Please login again",404);
}
if ($session->getExpired()) {
return new JsonResponse("Please login again", 400);