Skip to content

Instantly share code, notes, and snippets.

@noeticpenguin
Last active April 21, 2021 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save noeticpenguin/5f6522fb02eeaefc97b6 to your computer and use it in GitHub Desktop.
Save noeticpenguin/5f6522fb02eeaefc97b6 to your computer and use it in GitHub Desktop.
Community Debugger controller
public with sharing class CommunityDebuggerCtrl {
public String failingPageResponse { get; set; }
String toLoad {get; private set;}
Map<String, String> params {get; private set;}
String queryString = '?';
public CommunityDebuggerCtrl() {
params = ApexPages.currentPage().getParameters();
toLoad = (String) params.get('page');
params.remove('page');
system.debug('params' + params);
boolean first = true;
for (String key : params.keyset()) {
if(first){
queryString = queryString + key + '=' + params.get(key);
first = false;
}
else
queryString = queryString + '&' + key + '=' + params.get(key);
}
}
public void fetchFailingPage() {
try {
system.debug('Loading this url: ' + toLoad + queryString);
PageReference fail = new PageReference('/' + toLoad + queryString);
failingPageResponse = fail.getContent().toString();
} catch (Exception e) {
failingPageResponse = e.getTypeName() + ' : ' + e.getMessage() + ' : ' + e.getStackTraceString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment