dnaaun / openFraming

Tools for automatic frame discovery and labeling based on topic modeling and deep learning, made widely accessible to researchers from non computational backgrounds.
http://www.openframing.org
9 stars 7 forks source link

Add error handling to LDA page #339

Closed vidyaap closed 3 years ago

dnaaun commented 3 years ago

Thanks @vidyaap . I got approval to setup a dev server, so I'll do that and then hopefully test this PR over there :) Expect a review this afternoon.

monajalal commented 3 years ago

I will review after @davidatbu sets up the remote dev server and share my comments.

dnaaun commented 3 years ago

It looks like setting up the dev server will take me longer than an afternoon(sorry @monajalal !). I am going to try to locally review the PR, and then setup the dev server sometime before next week.

dnaaun commented 3 years ago

Hi Vidya,

I will put this in the docs soon, but basically, every field in the body of a JSON request will be validated and a possible error might be returned. My suggested way of differentiating between the previous kinds and these kinds of errors is checking for a ".message" property on the returned JSON, as that is not a field name in the body of any endpoint.

Am I making sense?

On Wed, Dec 9, 2020 at 4:34 PM Vidya Akavoor notifications@github.com wrote:

@vidyaap commented on this pull request.

In services/web/frontend/js/lda.js https://github.com/davidatbu/openFraming/pull/339#discussion_r539664455:

@@ -68,15 +68,17 @@ $(function() { console.log('success in training file POST'); $('#tm-success-message').removeAttr('hidden'); },

  • error: function (err) {
  • console.log(err);
  • $('#err-uploading').removeAttr('hidden');
  • error: function (xhr, status, err) {
  • console.log(xhr.responseText);
  • $('#err-uploading').html(An error occurred while uploading your file: ${JSON.parse(xhr.responseText).message})

Will do, where can I find the other formats that might get returned? Or is num_topics the only nested one?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davidatbu/openFraming/pull/339#discussion_r539664455, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMQIHC2337MWTQLBKFCL4ITST7UNNANCNFSM4UTVZDYQ .

vidyaap commented 3 years ago

Makes sense, since they'll all have a messages property though, I'll just check whether it's an object and show whatever messages are in that object.

dnaaun commented 3 years ago

Yes, what you said makes much better sense actually. What I said about how to differentiate the errors makes no sense. Thanks for understanding my blabbering.

vidyaap commented 3 years ago

Alright, this should take care of any keys as long as it comes back in a "messages" object. Btw I didn't have any UI handling for the loopingTesting() function because I assumed those errors would get sent via email. Let me know if that is not the case!

dnaaun commented 3 years ago

Hey Vidya, sorry for the silence again. Thanks for this!