cakeRequest resulting in "Undefined property" error - cakephp-2.0

I am working with a request object:
$this->request
and received the following error:
Undefined property: EventsController::$request

Are you certain you are running Cake 2.0 and not 1.3? What's the output of Configure::version()?
Cake only throws this error when the property is actually undefined. In 2.0 you should get a fully populated request object. Using $this->request in 1.3 throws the error you're receiving.

Related

Error if comment in json when using Ext.decode() in ExtJS 7

Ext.decode() is very strict now. It throws error when there's a comment in the JSON or any invalid json format, such as no double quote.
How can I disable such checking?
Ext.decode('{ test: test}');
OR
Ext.decode(`{//test
"include": [
"main.json"
]
}`)
Uncaught Error: You're trying to decode an invalid JSON String:
But this will not throw error in 6.2.0
Like devbnz mentioned, there's a 2nd param, if set to true, method wont throw an error and will return null instead.
https://docs.sencha.com/extjs/6.5.3/classic/Ext.html#method-decode
But yet prior to 6.6.0, Ext.decode() still can accept invalid json. It was fixed in 6.6.0
https://docs.sencha.com/extjs/6.6.0/guides/whats_new/release_notes.html
EXTJS-18443 JSON decoder should throw exception on invalid syntax
[UPDATE] My answer is wrong. There's no solution for now. You cannot decode a JSON with comment using Ext.decode in ExtJs7

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'defaultView' of undefined [duplicate]

I am trying to use Selenium for Python eith the Chrome webdriver to automate the download of a file.
My program works perfectly up to the last step (clicking on the 'download' button) at which point a dialog box is triggered with the text:
"An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined41"
What does this error mean and what are the most probable causes?
For reference, here are the last few commands of my program:
try:
elem = wait.until(EC.presence_of_element_located((By.ID,'element_1_id')))
finally:
elem1 = driver.find_element_by_id('element_1_id')
elem2 = driver.find_element_by_id('element_2_id')
action = ActionChains(driver).move_to_element(elem1).move_to_element(elem2)
action.perform()
elem2.click()
This error message...
An error has occured in 'site url': Uncaught TypeError: Cannot read property 'getColomnSet' of undefined
...implies that your program was unable to read the property getColomnSet while trying to download the desired file.
Possibly, the main problem is the js involved to download the document is invoked before the client renders the HTML DOM completely.
The relevant HTML, a bit more of your previous lines of code and the error stack trace would have given us some more idea about what's going wrong.
Solution
You can induce some measures to wait till the complete DOM Tree is rendered following the discussion:
Generic funtion to check if page has completely loaded in Selenium
A couple of facts:
In your code trials I don't see you interacting with the element (By.ID,'element_1_id') so possibly you can remove the step of presence_of_element_located() for the element (By.ID,'element_1_id').
If you still require presence_of_element_located((By.ID,'element_1_id')) catch the exception and initiate required steps.
As you invoke move_to_element() over elem1 and elem2 and moving ahead invoke perform() you need to induce WebDriverWait with expected_conditions as element_to_be_clickable(locator)
tl;dr (references)
Cannot read property 'getContext' of null, using canvas
Uncaught TypeError: Cannot read property 'getContext' of undefined
Uncaught Error remote.js
Try the following - it works on Salesforce Lightning UI screens:
WebElement element = driver.findElement(By.id("your ID"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);

I have unknown error in console in my react application

What does it mean?
Error in event handler for (unknown):
TypeError: Cannot read property 'response' of undefined
at t.runtime.sendMessage.e (chrome-extension://mlomiejdfkolichcflejclcbmpeaniij/dist/content_script_bundle.js:1:22694)
Chrome extension with id mlomiejdfkolichcflejclcbmpeaniij seems to be ghostery. You probably should disable it for local development.

Error in requesting track for url for SPTTrack object

I am trying to get SPTTrack object from url using Spotify iOS SKD v10beta.
Somehow, it returns an error, like :
Error Domain=com.spotify.ios-sdk Code=102 "No registered class for type 'artist'" UserInfo=0x7a644700 {NSLocalizedDescription=No registered class for type 'artist'}
Strange thing, that it has worked previously. I have found similar problem in getting the user.
What this error is related to? I have removed/added,linked spotify framework multiple times.
Ideas?
Error occurred because ObjC was not present at Other Linker Flags in frameworks/libraries/targets/project.

Adding 403 Exception view to CakePHP application

I am trying to throw a 403 (Forbidden error) in my controller. When the exception is thrown, I would like to display the associated view. I was under the assumption that if the error is one of the built in exceptions, this would be pretty easy. I throw the exception like this:
throw new ForbiddenException("You do not have permission to view this page.");
I also created a view called "error403.ctp" in the app/view/Errors folder (it already contained 400 and 500). The problem is that when the error is thrown, it displays the error400.ctp view instead. Do I have to create custom exceptions for a built in error? What am I doing wrong.
From http://book.cakephp.org/2.0/en/development/exceptions.html#exception-renderer
"For all 4xx and 5xx errors the view files error400.ctp and error500.ctp are used respectively."
So you aren't doing anything wrong, that's just the default CakePHP behavior. As to how to change it so that you can have a 403 page separate from the other 4XX errors, see CakePHP 2.0 - How to make custom error pages?
I don't have the exact cake version you are using, so I'll use links to docs of version 2.3, but it should apply to any version 2.x.
If you look at the default ExceptionRenderer construct, you get this from the description
Creates the controller to perform rendering on the error response. If the error is a CakeException it will be converted to either a 400 or a 500 code error depending on the code used to construct the error.
And clear enough, from the code of that function, all errors get mapped to that:
$method = 'error500';
if ($code >= 400 && $code < 500) {
$method = 'error400';
}
You'll have to create a custom Exception Renderer if you want to use other views. Also, keep in mind that when using debug < 1, you'll only get 500 error pages
Captures and handles all unhandled exceptions. Displays helpful framework errors when debug > 1. When debug < 1 a CakeException will render 404 or 500 errors. If an uncaught exception is thrown and it is a type that ExceptionHandler does not know about it will be treated as a 500 error.

Resources