Skip to content

Commit 1cb7c43

Browse files
Code cleaning
1 parent 0e16eab commit 1cb7c43

File tree

1 file changed

+109
-108
lines changed

1 file changed

+109
-108
lines changed

tmcrstudioaddin/R/AddinSubmitTab.R

+109-108
Original file line numberDiff line numberDiff line change
@@ -278,114 +278,6 @@
278278
}
279279
}
280280

281-
.help_text_for_serious_error <- function(message) {
282-
pre_error <- message
283-
messages_tmp <-
284-
c(c("Unauthorized (HTTP 401).",
285-
paste("Your submission was refused by server (HTTP 401).",
286-
"This most likely means that the submission deadline",
287-
"has closed.</p><p>Please check that you have chosen the",
288-
"right exercise set."),
289-
paste("Your submission was refused by server (HTTP 401).",
290-
"This most likely means that the submission deadline",
291-
"has closed.</p><p>Please check that you have chosen the",
292-
"right exercise set.")),
293-
c("Forbidden (HTTP 403).",
294-
paste("Your submission failed as forbidden request (HTTP 403).",
295-
"</p><p>This happens after submission deadline has closed.",
296-
"Please check that you have chosen the",
297-
"right exercise set.",
298-
"</p>Other common cause of this are firewalls, VPN's,",
299-
"antivirus programs that block the connection as well as",
300-
"stale credentials. It can also happen if the server is",
301-
"down. </p><p> Try logging out and back in from addin in a",
302-
"different network and check if tmc.mooc.fi is working.",
303-
"</p><p> If the problem persists, please contact the course",
304-
"instructors."),
305-
paste("Your submission failed as forbidden request (HTTP 403).",
306-
"</p><p>This happens after submission deadline has closed.",
307-
"Please check that you have chosen the",
308-
"right exercise set.",
309-
"</p>Other common cause of this are firewalls, VPN's,",
310-
"antivirus programs that block the connection as well as",
311-
"stale credentials. It can also happen if the server is",
312-
"down. </p><p> Try logging out and back in from addin in a",
313-
"different network and check if tmc.mooc.fi is working.",
314-
"</p><p> If the problem persists, please contact the course",
315-
"instructors.")),
316-
c("file.exists(path) is not TRUE",
317-
paste("Submission uploading failed with 'file.exists(path)",
318-
"is not TRUE'. </p><p> The reason for this is most likely",
319-
"with your installation of Rtools. Please take a look at",
320-
"Rtools installationmanual. </p><p> If you are unable to fix this",
321-
"contact the course instructors in this case."),
322-
paste("Submission uploading failed with 'file.exists(path)",
323-
"is not TRUE'. </p><p> This is most likely an issue with",
324-
"file permissions. </p><p> Please contact the course instructors",
325-
"in this case.")),
326-
c("Bad Gateway (HTTP 502).",
327-
paste("Your submission failed with 'Bad Gateway (HTTP 502)'.",
328-
"You can try restarting RStudio and RTMC and then resubmitting.",
329-
"</p><p>This can also mean that server is is temporarily not accepting",
330-
"requests. You should try resubmitting again later, but if you",
331-
"are in a hurry, contact the course teacher"),
332-
paste("Your submission failed with 'Bad Gateway (HTTP 502)'.",
333-
"You can try restarting RStudio and RTMC and then resubmitting.",
334-
"</p><p>This can also mean that server is is temporarily not accepting",
335-
"requests. You should try resubmitting again later, but if you",
336-
"are in a hurry, contact the course teacher")),
337-
c("LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60",
338-
paste("Your submission failed with 'LibreSSL ... errno 60'",
339-
"This usually means that your connection failed just before",
340-
"the submission. You should try resubmitting immediately",
341-
"again for more informative",
342-
"error message."),
343-
paste("Your submission failed with 'LibreSSL ... errno 60'",
344-
"This usually means that your connection failed just before",
345-
"the submission. You should try resubmitting immediately",
346-
"again for more informative",
347-
"error message.")),
348-
c("Couldn't connect to server",
349-
paste("The server could not be reached. This almost surely means",
350-
"that your network connection is not working currently.",
351-
"Please check that first.",
352-
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
353-
"currently unreachable. You should try resubmitting again later.",
354-
"If the server is down, please contact the course teacher, if the",
355-
"submission deadline is close"),
356-
paste("The server could not be reached. This almost surely means",
357-
"that your network connection is not working currently.",
358-
"Please check that first.",
359-
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
360-
"currently unreachable. You should try resubmitting again later.",
361-
"If the server is down, please contact the course teacher, if the",
362-
"submission deadline is close")),
363-
c("Could not resolve host: tmc.mooc.fi",
364-
paste("Host tmc.mooc.fi could not be reached. Do you have a working",
365-
"network connection? Please check that first.",
366-
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
367-
"currently unreachable. You should try resubmitting again later.",
368-
"</p><p>If the server is down, please contact the course teacher, if the",
369-
"submission deadline is close"),
370-
paste("Host tmc.mooc.fi could not be reached. Do you have a working",
371-
"network connection? Please check that first.",
372-
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
373-
"currently unreachable. You should try resubmitting again later.",
374-
"</p><p>If the server is down, please contact the course teacher, if the",
375-
"submission deadline is close")),
376-
c(pre_error,
377-
paste(pre_error, "</p><p>Please contact the course instructors in this case."),
378-
paste(pre_error, "</p><p>Please contact the course instructors in this case.")))
379-
messages_tmp <- matrix(byrow = TRUE, ncol = 3, messages_tmp)
380-
errormsgs <- list(keys = messages_tmp[ , 1],
381-
msgs_win = messages_tmp[ , 2],
382-
msgs_unix = messages_tmp[ , 3])
383-
if (!is.null(.Platform$OS.type) && .Platform$OS.type == "windows") {
384-
errormsg <- errormsgs$msgs_win[errormsgs$keys == pre_error][1]
385-
} else {
386-
errormsg <- errormsgs$msgs_unix[errormsgs$keys == pre_error][1]
387-
}
388-
}
389281

390282
.help_text_for_error <- function(message) {
391283
console_error <- message
@@ -778,3 +670,112 @@
778670
shiny::tagList(html)
779671
})
780672
}
673+
674+
.help_text_for_serious_error <- function(message) {
675+
pre_error <- message
676+
messages_tmp <-
677+
c(c("Unauthorized (HTTP 401).",
678+
paste("Your submission was refused by server (HTTP 401).",
679+
"This most likely means that the submission deadline",
680+
"has closed.</p><p>Please check that you have chosen the",
681+
"right exercise set."),
682+
paste("Your submission was refused by server (HTTP 401).",
683+
"This most likely means that the submission deadline",
684+
"has closed.</p><p>Please check that you have chosen the",
685+
"right exercise set.")),
686+
c("Forbidden (HTTP 403).",
687+
paste("Your submission failed as forbidden request (HTTP 403).",
688+
"</p><p>This happens after submission deadline has closed.",
689+
"Please check that you have chosen the",
690+
"right exercise set.",
691+
"</p>Other common cause of this are firewalls, VPN's,",
692+
"antivirus programs that block the connection as well as",
693+
"stale credentials. It can also happen if the server is",
694+
"down. </p><p> Try logging out and back in from addin in a",
695+
"different network and check if tmc.mooc.fi is working.",
696+
"</p><p> If the problem persists, please contact the course",
697+
"instructors."),
698+
paste("Your submission failed as forbidden request (HTTP 403).",
699+
"</p><p>This happens after submission deadline has closed.",
700+
"Please check that you have chosen the",
701+
"right exercise set.",
702+
"</p>Other common cause of this are firewalls, VPN's,",
703+
"antivirus programs that block the connection as well as",
704+
"stale credentials. It can also happen if the server is",
705+
"down. </p><p> Try logging out and back in from addin in a",
706+
"different network and check if tmc.mooc.fi is working.",
707+
"</p><p> If the problem persists, please contact the course",
708+
"instructors.")),
709+
c("file.exists(path) is not TRUE",
710+
paste("Submission uploading failed with 'file.exists(path)",
711+
"is not TRUE'. </p><p> The reason for this is most likely",
712+
"with your installation of Rtools. Please take a look at",
713+
"Rtools installationmanual. </p><p> If you are unable to fix this",
714+
"contact the course instructors in this case."),
715+
paste("Submission uploading failed with 'file.exists(path)",
716+
"is not TRUE'. </p><p> This is most likely an issue with",
717+
"file permissions. </p><p> Please contact the course instructors",
718+
"in this case.")),
719+
c("Bad Gateway (HTTP 502).",
720+
paste("Your submission failed with 'Bad Gateway (HTTP 502)'.",
721+
"You can try restarting RStudio and RTMC and then resubmitting.",
722+
"</p><p>This can also mean that server is is temporarily not accepting",
723+
"requests. You should try resubmitting again later, but if you",
724+
"are in a hurry, contact the course teacher"),
725+
paste("Your submission failed with 'Bad Gateway (HTTP 502)'.",
726+
"You can try restarting RStudio and RTMC and then resubmitting.",
727+
"</p><p>This can also mean that server is is temporarily not accepting",
728+
"requests. You should try resubmitting again later, but if you",
729+
"are in a hurry, contact the course teacher")),
730+
c("LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60",
731+
paste("Your submission failed with 'LibreSSL ... errno 60'",
732+
"This usually means that your connection failed just before",
733+
"the submission. You should try resubmitting immediately",
734+
"again for more informative",
735+
"error message."),
736+
paste("Your submission failed with 'LibreSSL ... errno 60'",
737+
"This usually means that your connection failed just before",
738+
"the submission. You should try resubmitting immediately",
739+
"again for more informative",
740+
"error message.")),
741+
c("Couldn't connect to server",
742+
paste("The server could not be reached. This almost surely means",
743+
"that your network connection is not working currently.",
744+
"Please check that first.",
745+
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
746+
"currently unreachable. You should try resubmitting again later.",
747+
"If the server is down, please contact the course teacher, if the",
748+
"submission deadline is close"),
749+
paste("The server could not be reached. This almost surely means",
750+
"that your network connection is not working currently.",
751+
"Please check that first.",
752+
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
753+
"currently unreachable. You should try resubmitting again later.",
754+
"If the server is down, please contact the course teacher, if the",
755+
"submission deadline is close")),
756+
c("Could not resolve host: tmc.mooc.fi",
757+
paste("Host tmc.mooc.fi could not be reached. Do you have a working",
758+
"network connection? Please check that first.",
759+
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
760+
"currently unreachable. You should try resubmitting again later.",
761+
"</p><p>If the server is down, please contact the course teacher, if the",
762+
"submission deadline is close"),
763+
paste("Host tmc.mooc.fi could not be reached. Do you have a working",
764+
"network connection? Please check that first.",
765+
"</p><p>If the network connection is working, then tmc.mooc.fi might be",
766+
"currently unreachable. You should try resubmitting again later.",
767+
"</p><p>If the server is down, please contact the course teacher, if the",
768+
"submission deadline is close")),
769+
c(pre_error,
770+
paste(pre_error, "</p><p>Please contact the course instructors in this case."),
771+
paste(pre_error, "</p><p>Please contact the course instructors in this case.")))
772+
messages_tmp <- matrix(byrow = TRUE, ncol = 3, messages_tmp)
773+
errormsgs <- list(keys = messages_tmp[ , 1],
774+
msgs_win = messages_tmp[ , 2],
775+
msgs_unix = messages_tmp[ , 3])
776+
if (!is.null(.Platform$OS.type) && .Platform$OS.type == "windows") {
777+
errormsg <- errormsgs$msgs_win[errormsgs$keys == pre_error][1]
778+
} else {
779+
errormsg <- errormsgs$msgs_unix[errormsgs$keys == pre_error][1]
780+
}
781+
}

0 commit comments

Comments
 (0)