rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
129 stars 79 forks source link

escape codes presented by IDE when target application deleted #1026

Open aronatkins opened 8 months ago

aronatkins commented 8 months ago
image

Steps to reproduce:

  1. deploy a Shiny application to a Connect server using push-button deployment in the RStudio IDE
  2. delete that Shiny application from Connect
  3. attempt to redeploy using the publish button in the RStudio IDE

This message includes an escape code because the IDE attempts to rewrite the application lookup error with:

https://github.com/rstudio/rstudio/blob/8244ebc49cc3188f04aa26bb2c2377aeda315817/src/cpp/session/modules/SessionRSConnect.R#L212-L218

You can see similar information locally with:

tryCatch({
    rsconnect:::getAppById(appId, account, server, hostUrl)
}, error=function(e)conditionMessage(e))

That produces (redacted by hand):

[1] "\033[38;5;232mCan't find app with id \"APP_ID\"\033[39m\n\033[1mCaused by error in `GET()`:\033[22m\n\033[38;5;232m\033[33m!\033[38;5;232m <https://SERVER_HOSTNAME/__api__/applications/APP_ID> failed with HTTP status 404\nThe requested object does not exist.\033[39m"

The rsconnect:::getAppById() function should produce output that can be included by the IDE in its UI.

hadley commented 8 months ago

Probably need to locally set options(crayon.enabled = FALSE).